Summary:ASTERISK-03191: [PATCH] Convert app_dial to use flags - tweaks for chan_iax2 and chan_sip
Reporter:Russell Bryant (russell)Labels:
Date Opened:2005-01-05 15:16:26.000-0600Date Closed:2008-01-15 15:20:11.000-0600
Versions:Frequency of
Environment:Attachments:( 0) dialflags.txt
( 1) moreflagstuff.txt
 - Get rid of a lot of ints in favor of using flags

 - change flags to unsigned ints

 - change flags to unsigned ints
 - use flag macros when manipulating flags in sip_pkt


disclaimer is on file
Comments:By: Russell Bryant (russell) 2005-01-05 15:17:00.000-0600

This needs to be tested to make sure I didn't break app_dial

By: Kevin P. Fleming (kpfleming) 2005-01-05 15:47:49.000-0600

Some notes (take them as you will <G>):

+if (!ast_test_flag(outgoing, DIAL_RINGBACKONLY) && !ast_test_flag(outgoing, DIAL_MUSICONHOLD)) {
+!(ast_test_flag(outgoing, DIAL_RINGBACKONLY) || ast_test_flag(outgoing, DIAL_MUSICONHOLD))) {

Both of these can be simplified to:

!ast_test_flag(outgoing, DIAL_RINGBACKONLY | DIAL_MUSICONHOLD)

(in other words, we want to find out of if either of them are set)

I would rename "locflags" to "peerflags", since they are the flags that result of connecting to a particular peer.

+ast_set2_flag(tmp, strchr(transfer, 'H'), DIAL_ALLOWDISCONNECT_OUT);
+ast_set2_flag(tmp, strchr(transfer, 'h'), DIAL_ALLOWDISCONNECT_IN);

In the original code, these options set _both_ the local flag and the one in tmp; if there is any path in the code where the final peer's flags might not get copied back into peerflags (locflags), you should probably set them here as well.

+if (ast_test_flag(&locflags, DIAL_ALLOWREDIRECT_IN))
config.features_callee |= AST_FEATURE_REDIRECT;

Ugh... why is the features config not using the flag macros? Can we convert config.features_callee/features_caller into "struct ast_flags"?

Other than these I think the flags conversion is spot-on; I don't see any place where the logic has been changed.

By: Mark Spencer (markster) 2005-01-05 17:00:59.000-0600

Added to CVS, thanks!

By: Russell Bryant (russell) 2005-01-05 18:01:40.000-0600

uploaded a patch with a few tweaks from kpfleming's comments.

I'm going to leave the features stuff alone for now since it is used in multiple files.  I'll put it on the to-do list...

By: Mark Spencer (markster) 2005-01-05 20:54:29.000-0600

Fixed again :)

By: Digium Subversion (svnbot) 2008-01-15 15:20:08.000-0600

Repository: asterisk
Revision: 4685

U   trunk/apps/app_dial.c
U   trunk/channels/chan_iax2.c
U   trunk/channels/chan_sip.c

r4685 | markster | 2008-01-15 15:20:07 -0600 (Tue, 15 Jan 2008) | 2 lines

More flagification (bug ASTERISK-3191)



By: Digium Subversion (svnbot) 2008-01-15 15:20:11.000-0600

Repository: asterisk
Revision: 4689

U   trunk/apps/app_dial.c

r4689 | markster | 2008-01-15 15:20:11 -0600 (Tue, 15 Jan 2008) | 2 lines

More flag on dial tweaks (bug ASTERISK-3191, take two)