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

Kevin P. Fleming kpfleming at digium.com
Mon Oct 10 11:36:31 CDT 2011


On 10/10/2011 11:25 AM, Pavel Troller wrote:
> 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 :-(.

Your analysis is correct. If someone set 'faxdetect=t38', they would get 
bizarre behavior as a result.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kfleming at digium.com | SIP: kpfleming at digium.com | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list