[OpenSIPS-Users] 'methods' column in 'location' table.

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Apr 30 13:31:09 CEST 2009


Hi Chris,

If you want, you may add this tip here:
    http://www.opensips.org/Resources/DocsTipsFaqs

Thanks and regards,
Bogdan

Chris Maciejewski wrote:
> Hi Bogdan,
>
> Thanks for you help.
>
> For anyone interested a bit of PHP code, which decodes methods
> supported by UA from 'methods' column in a location table:
>
> <?php
> $mask = 7999;
>
> $methods = array (
>   "0" => "UNDEF",           /* 0 - --- */
>   "1" => "INVITE",          /* 1 - 2^0 */
>   "2" => "CANCEL",          /* 2 - 2^1 */
>   "4" => "ACK",             /* 3 - 2^2 */
>   "8" => "BYE",             /* 4 - 2^3 */
>   "16" => "INFO",           /* 5 - 2^4 */
>   "32" => "OPTIONS",        /* 6 - 2^5 */
>   "64" => "UPDATE",         /* 7 - 2^6 */
>   "128" => "REGISTER",      /* 8 - 2^7 */
>   "256" => "MESSAGE",       /* 9 - 2^8 */
>   "512" => "SUBSCRIBE",     /* 10 - 2^9 */
>   "1024" => "NOTIFY",       /* 11 - 2^10 */
>   "2048" => "PRACK",        /* 12 - 2^11 */
>   "4096" => "REFER",        /* 13 - 2^12 */
>   "8192" => "PUBLISH",      /* 14 - 2^13 */
>   "16384" => "OTHER"        /* 15 - 2^14 */
> );
>
> $supported = '';
>
> foreach ($methods as $id => $method)
> {
>   if ($id & $mask)
>   {
>     $supported.= $method.", ";
>   }
> }
>
> echo "Supported methods: $supported";
>
> ?>
>
> prints:
> Supported methods: INVITE, CANCEL, ACK, BYE, INFO, OPTIONS, MESSAGE,
> SUBSCRIBE, NOTIFY, PRACK, REFER,
>
> 2009/4/30 Bogdan-Andrei Iancu <bogdan at voice-system.ro>:
>   
>> Hi Chris,
>>
>> That field is internally used, so it is not so friendly to look at :). This
>> value is a bitmask containing the supported methods. The definition of each
>> method (corresponding bit in the mask) can be found in parser/msg_parser.h
>> +67 .
>>
>> 7999 = 4096 + 2048 + 1024 + 512 + 256 + 32 + 16 + 8 + 4 +2 +1
>> => REFER, PRACK, NOTIFY, SUBSCRIBE, MESSAGE, OPTIONS, INFO, BYE , ACK,
>> CANCEL, INVITE
>>
>> Regards,
>> Bogdan
>>
>> Chris Maciejewski wrote:
>>     
>>> Hi,
>>>
>>> I would like to ask how to decode 'methods' column in a 'location' table.
>>>
>>> For example I can see my UA registered '7999' methods?
>>>
>>> But how to interpret this numerical flags?
>>>
>>> Any help very much appreciated.
>>>
>>> Best regards,
>>> Chris
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>       
>>     
>
> Regards,
>
> Chris
>
>   




More information about the Users mailing list