[asterisk-dev] chan_sip source: Flags definition: Is this a bug, or am I stupid ?

Pavel Troller patrol at sinus.cz
Mon Oct 10 11:25:31 CDT 2011


Hi!
  I'm writing a patch for better handling of overlap dialling in chan_sip for
review (see my other thread in the list) and I've found the following in 
flags definition in sip.h, 1.8 branch:

... (line 338)
#define SIP_PAGE2_RFC2833_COMPENSATE            (1 << 20)  /*!< DP: Compensate for buggy RFC2833 implementations */
#define SIP_PAGE2_BUGGY_MWI                     (1 << 21)  /*!< DP: Buggy CISCO MWI fix */
#define SIP_PAGE2_DIALOG_ESTABLISHED            (1 << 22)  /*!< 29: Has a dialog been established? */

#define SIP_PAGE2_FAX_DETECT                    (3 << 23)  /*!< DP: Fax Detection support */
#define SIP_PAGE2_FAX_DETECT_CNG                (1 << 23)  /*!< DP: Fax Detection support - detect CNG in audio */
#define SIP_PAGE2_FAX_DETECT_T38                (2 << 23)  /*!< DP: Fax Detection support - detect T.38 reinvite from peer */
#define SIP_PAGE2_FAX_DETECT_BOTH               (3 << 23)  /*!< DP: Fax Detection support - detect both */

#define SIP_PAGE2_REGISTERTRYING                (1 << 24)  /*!< DP: Send 100 Trying on REGISTER attempts */
#define SIP_PAGE2_UDPTL_DESTINATION             (1 << 25)  /*!< DP: Use source IP of RTP as destination if NAT is enabled */
#define SIP_PAGE2_VIDEOSUPPORT_ALWAYS           (1 << 26)  /*!< DP: Always set up video, even if endpoints don't support it */
#define SIP_PAGE2_HAVEPEERCONTEXT       (1 << 27)       /*< Are we associated with a configured peer context? */
#define SIP_PAGE2_USE_SRTP              (1 << 28)    /*!< DP: Whether we should offer (only)  SRTP */

If I understand correctly, SIP_PAGE2_FAX_DETECT flags take 2 bits,
so SIP_PAGE2_REGISTERTRYING should be (1 << 25) ? Otherwise, it will mix
up with the FAX detection.. An of course the rest should be shifted too...
Or am I wrong ? In this case, I probably don't understand just a plain C :-(.

With regards, Pavel



More information about the asterisk-dev mailing list