[sr-dev] How to get source and destination ip and port details in corex module
Niraj
niraj.r at sabsebolo.com
Fri Jun 24 08:38:52 CEST 2016
Hi Eduardo Lejarreta,
Thank you for your detailed reply.
What you are suggesting holds good for all those messages hits any
of the route segment in the script. But my struggle starts while dealing
with auto-responded messages like 100 Trying, ACK and 200 OK against the
CANCEL message etc.
That's why I was thinking of implementing another pseudo variable
capturing necessary details and still available at [network:msg] event
route though it is meant to have only raw packets.
Also I can see corex module works in binary mode only, either to
compress/encrypt or decompress/decrypt. But Kamailio being a proxy need
to deal with gateways at one end and end user client at other (In very
general usage terms. though many more possibilities are there) and the
primary purpose for which it was written was to deal all these custom
manipulations between the end user client and kamailio but it forces
kamailio to treat the gateways in the same manner which I think defeats
in someway what kamailio has been doing so far. E.g.
client<----TLS---->Kamailio<---UDP/TCP----->External Gateways.
Olle,
Hope you can understand where I am heading towards.
Thanks & Regards,
Niraj
On Wednesday 22 June 2016 06:06 PM, Eduardo Lejarreta wrote:
> 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
>
> _______________________________________________
> 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
More information about the sr-dev
mailing list