diff -rup asterisk-1.6.1.0-orig/channels/chan_sip.c asterisk-1.6.1.0/channels/chan_sip.c --- asterisk-1.6.1.0-orig/channels/chan_sip.c 2009-04-20 19:08:26.000000000 +0200 +++ asterisk-1.6.1.0/channels/chan_sip.c 2009-06-15 07:31:06.000000000 +0200 @@ -1022,23 +1022,24 @@ struct sip_auth { #define SIP_NAT_ALWAYS (3 << 18) /*!< DP: NAT Both ROUTE and RFC3581 */ /* re-INVITE related settings */ -#define SIP_REINVITE (7 << 20) /*!< DP: four settings, uses three bits */ +#define SIP_REINVITE (15 << 20) /*!< DP: five settings, uses four bits */ #define SIP_REINVITE_NONE (0 << 20) /*!< DP: no reinvite allowed */ #define SIP_CAN_REINVITE (1 << 20) /*!< DP: allow peers to be reinvited to send media directly p2p */ #define SIP_CAN_REINVITE_NAT (2 << 20) /*!< DP: allow media reinvite when new peer is behind NAT */ #define SIP_REINVITE_UPDATE (4 << 20) /*!< DP: use UPDATE (RFC3311) when reinviting this peer */ +#define SIP_REINVITE_NEWBRANCH (8 << 20) /*!< DP: Genereate new branch parameter in via header */ /* "insecure" settings - see insecure2str() */ -#define SIP_INSECURE (3 << 23) /*!< DP: three settings, uses two bits */ -#define SIP_INSECURE_NONE (0 << 23) /*!< DP: secure mode */ -#define SIP_INSECURE_PORT (1 << 23) /*!< DP: don't require matching port for incoming requests */ -#define SIP_INSECURE_INVITE (1 << 24) /*!< DP: don't require authentication for incoming INVITEs */ +#define SIP_INSECURE (3 << 24) /*!< DP: three settings, uses two bits */ +#define SIP_INSECURE_NONE (0 << 24) /*!< DP: secure mode */ +#define SIP_INSECURE_PORT (1 << 24) /*!< DP: don't require matching port for incoming requests */ +#define SIP_INSECURE_INVITE (1 << 25) /*!< DP: don't require authentication for incoming INVITEs */ /* Sending PROGRESS in-band settings */ -#define SIP_PROG_INBAND (3 << 25) /*!< DP: three settings, uses two bits */ -#define SIP_PROG_INBAND_NEVER (0 << 25) -#define SIP_PROG_INBAND_NO (1 << 25) -#define SIP_PROG_INBAND_YES (2 << 25) +#define SIP_PROG_INBAND (3 << 26) /*!< DP: three settings, uses two bits */ +#define SIP_PROG_INBAND_NEVER (0 << 26) +#define SIP_PROG_INBAND_NO (1 << 26) +#define SIP_PROG_INBAND_YES (2 << 26) #define SIP_SENDRPID (1 << 29) /*!< DP: Remote Party-ID Support */ #define SIP_G726_NONSTANDARD (1 << 31) /*!< DP: Use non-standard packing for G726-32 data */ @@ -8046,7 +8047,7 @@ static int reqprep(struct sip_request *r seqno = p->ocseq; } - if (sipmethod == SIP_CANCEL || sipmethod == SIP_INVITE) { + if (sipmethod == SIP_CANCEL || (sipmethod == SIP_INVITE && !ast_test_flag(&p->flags[0], SIP_REINVITE_NEWBRANCH))) { p->branch = p->invite_branch; build_via(p); } else if (newbranch) { @@ -21238,6 +21239,8 @@ static int handle_common_options(struct } else if (!strcasecmp(word, "nonat")) { ast_set_flag(&flags[0], SIP_CAN_REINVITE); ast_clear_flag(&flags[0], SIP_CAN_REINVITE_NAT); + } else if (!strcasecmp(word, "newbranch")) { + ast_set_flag(&flags[0], SIP_REINVITE_NEWBRANCH | SIP_CAN_REINVITE | SIP_CAN_REINVITE_NAT); } else { ast_log(LOG_WARNING, "Unknown canreinvite mode '%s' on line %d\n", v->value, v->lineno); } diff -rup asterisk-1.6.1.0-orig/configs/sip.conf.sample asterisk-1.6.1.0/configs/sip.conf.sample --- asterisk-1.6.1.0-orig/configs/sip.conf.sample 2009-04-02 19:14:08.000000000 +0200 +++ asterisk-1.6.1.0/configs/sip.conf.sample 2009-06-15 08:06:45.000000000 +0200 @@ -615,6 +615,11 @@ srvlookup=yes ; Enable ; instead of INVITE. This can be combined with 'nonat', as ; 'canreinvite=update,nonat'. It implies 'yes'. +canreinvite=newbranch ; Generate a new branch parameter in via header of reinvites. + ; Can also combined with 'nat' and implies 'yes'. + ; Reinvites will fail otherwise with Patton Media Gatways or + ; SEN OpenStage Phones + ;----------------------------------------- REALTIME SUPPORT ------------------------ ; For additional information on ARA, the Asterisk Realtime Architecture, ; please read realtime.txt and extconfig.txt in the /doc directory of the