[sr-dev] How to get source and destination ip and port details in corex module
Eduardo Lejarreta
lejarreta.e at sarenet.es
Wed Jun 22 14:36:36 CEST 2016
Hi Niraj.
Read module help:
"
Please note this event route is meant to prepare the message for on-wire
communication, e.g. to do custom encryption or decryption,
compression/decompression etc. of the message sent to or received from
remote host. Therefore, except text operations, no module fucntions or
pseudo variables are available in this event route.
"
Forget to access or change someother than $avp(msg) like $si or $sp. But
think $avp(something) is still available.
On that route you can do something like these examples:
1.- You can acceso $si and $sp if you previously have assinegd them to
an $avp(var):
(with $avp(source_ip) previously assigned on any other route)
event_route[network:msg] {
xlog("L_INFO","ONREPLY: NETWORK_MSG $avp(source_ip)\n");
}
2.- You can also try to search on headers and do something like this
event_route[network:msg] {
if ( !is_incoming() ) {
if ( $mb =~ ".*application/sdp.*" ){
if ( $mb =~ ".*c=IN IP4 194\.30\.0\.82.*" ) {
xlog("L_DEBUG","EVENT_ROUTE: NETWORK_MSG '$mb'\n");
}else{
$avp(msg) = $mb;
$avp(msg) = "";
xlog("L_INFO","EVENT_ROUTE: NETWORK_MSG: DROP de MENSAJE: '$mb'
\n");
}
}
}
}
Hope this helps you.
Regards.
Eduardo Lejarreta.
El 22.06.2016 12:19, Olle E. Johansson escribió:
>> On 21 Jun 2016, at 13:03, Niraj <niraj.r at sabsebolo.com> wrote:
>>
>> Hi Olle,
>> Thanks for your reply. But I beg to differ that any other pseudo
>> variable available in this module apart from $mb and msg_avp. I have
>> already tried to use those variables but they all give <null> value.
> I think we must be talking about two different things. I talk about
> the script language - are you talking about
> C source code development?
>
> /O
>>
>> Thanks,
>> Niraj
>> On Tuesday 21 June 2016 04:23 PM, Olle E. Johansson wrote:
>>>> On 21 Jun 2016, at 12:19, Niraj <niraj.r at sabsebolo.com> wrote:
>>>>
>>>> Hi,
>>>> Corex module has only raw SIP message and no other pseudo variables
>>>> available. Can anybody shade some light on how to get source and
>>>> destination IP and port details for that particular SIP message?
>>> I think you need to read through the pseudovariable cookbook
>>> http://www.kamailio.org/wiki/cookbooks/4.4.x/pseudovariables
>>>
>>> You will find all you ask for and much more in that document!
>>>
>>> /O
>>> _______________________________________________
>>> sr-dev mailing list
>>> sr-dev at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>
>> --
>> Thanks & Regards,
>> Niraj Roy
>> Mob: +91 9426554400
>>
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
More information about the sr-dev
mailing list