[OpenSIPS-Users] Please explain what's wrong with is_method function in this code

Anca Vamanu anca at opensips.org
Thu Feb 10 15:30:20 CET 2011


Hi Tyler,

On 02/10/2011 05:33 AM, Tyler Merritt wrote:
> All,
>
> A very special issue I'm facing now.  I'm using "is_method" from the 
> reply block (starting with a "has_totag" which matches and then goes 
> inside that block to check stuff out).
>
> Here is the code:
>
> xlog ("L_INFO", "Right before the reINVITE check!\n");

I suggest you to print the message buffer here just to be sure. Use 
xlog("$mb\n");

Regards,

-- 
Anca Vamanu
OpenSIPS Developer



>                         if ( is_method("INVITE") ) {
>                                 append_hf("GW: REINVITE\r\n");
>                                 if ( t_check_trans() ) {
>                                         t_relay();
>                                         exit;
>                                 }
>                         }
>                         xlog ("L_INFO", "Right after the reINVITE 
> check!\n");
>                         sl_send_reply("404","Not here");
>
>
> Here is the packet:
>
>
> 12:18:24.725518 IP 192.168.1.134.5060 > 192.168.0.2.5060: SIP, length: 720
> E..... at ...v(................INVITE sip:XXXXXXXXXX at DOMAIN SIP/2.0
>
> CSeq: 443638 INVITE
>
>
> Here is the definition from the documentation:
>
>
>       |is_method(name)|
>
> Check if the method of the message matches the name. If name is a 
> known method (invite, cancel, ack, bye, options, info, update, 
> register, message, subscribe, notify, refer, prack), the function 
> performs method ID testing (integer comparison) instead of ignore case 
> string comparison.
>
> The 'name' can be a list of methods in the form of 
> 'method1|method2|...'. In this case, the function returns true if the 
> SIP message's method is one from the list. IMPORTANT NOTE: in the list 
> must be only methods defined in OpenSIPS with ID (invite, cancel, ack, 
> bye, options, info, update, register, message, subscribe, notify, 
> refer, prack, publish; for more 
> see:http://www.iana.org/assignments/sip-parameters).
>
> If used for replies, the function tests the value of method field from 
> CSeq header.
>
>
>
> If used for replies, the function tests the value of method field from 
> *CSeq header.*
>
> *
> *
>
> The CSeq header above sure enough has "INVITE" inside it.  And the 
> is_method filed is being used from a reply (it shouldn't really matter 
> though right?  It should match regardless).
>
>
> Please point out what I'm doing wrong - the daemon.log file shows:
>
>
> Feb 10 12:18:25 sip-proxy1 /usr/sbin/opensips[22658]: 
> DBG:rr:loose_route: There is no Route HF
>
> Feb 10 12:18:25 sip-proxy1 /usr/sbin/opensips[22658]: Right before the 
> reINVITE check!
>
> Feb 10 12:18:25 sip-proxy1 /usr/sbin/opensips[22658]: Right after the 
> reINVITE check!
>
>
> It *should* pass loose_route as it does, and then between the two log 
> messages stuff should happen - in this case, a match of the INVITE 
> header.
>
>
> I don't see what I'm doing wrong.
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110210/e6a0fb14/attachment-0001.htm>


More information about the Users mailing list