Hi Salah,
I got it working (capturing stateless replies in and out) with the
following parameter and routing script snippets.

onsend_route_reply=1

reply_route {



    xlog("L_INFO", "Incoming reply: $rm $rs\n");



    if (!t_check_trans()) {



        setflag(25);



        $var(rc) = sip_trace();


     }



}



onsend_route {
    if ($mt == 2) {



        xlog("Sending out reply to $rm: $rs\n");



        if (isflagset(25)) {



            sip_trace();



        }



    }



}

In reply_route I had to assign the output of sip_trace to a $var because of
en error in sip_trace which prevent the execution of onsend_route if called
in reply_route.
I'm going to fix it soon.

Hope this helps,

Federico

On Mon, Aug 26, 2019 at 4:58 PM Salah Ahmed <txru...@gmail.com> wrote:

> Hello Daniel,
>
> This is correct, we can get the forwarding message with $snd(buf) on the
> onsend_route. But unfortunately, there have no any sip_trace version to do
> log with a given message as method argument.
>
> Actually right now, we using trace_mode=1 setup. But we need to do log
> only for Kamailio to UAC side, not to do log for both side.
>
> Thanks,
> Salah
>
> On Mon, Aug 26, 2019 at 2:54 AM Daniel-Constantin Mierla <
> mico...@gmail.com> wrote:
>
>> Hello,
>>
>> the $mb and $msg(buf) still point to incoming message, even in the
>> onsend_route. The content of the outgoing buffer is in $snd(buf).
>>
>> Isn't trace_mode=1 giving what you need?
>>
>>   -
>> https://www.kamailio.org/docs/modules/stable/modules/siptrace.html#siptrace.p.trace_mode
>>
>> Or do you still want to filter some SIP message, not mirror everything?
>>
>> On the other hand, I expected sip_trace() to take the outgoing buffer in
>> onsend_route when mirroring, maybe it is not doing it for response...
>>
>> Cheers,
>> Daniel
>> On 25.08.19 18:50, Salah Ahmed wrote:
>>
>> Hello Henning,
>>
>> I have tried with $msg(buf) in the onsend_route, got those replies
>> received from UAS, but didn't found any replies what kamailio forwarded to
>> UAC. The sip_trace doing same, that's my concern, I think onsend_route we
>> suppose to get those reply messages which kamailio forwarded to UAC.
>>
>> For sip_trace use, we call sip_trace in the onsend_route, and didn't set
>> siptrace flag(22) anywhere in the script.
>>
>> Thanks,
>> Salah
>>
>> On Sun, Aug 25, 2019 at 11:41 AM Henning Westerholt <h...@skalatan.de>
>> wrote:
>>
>>> Hello Salah,
>>>
>>> add some logging (e.g. print the $mb PV) to see what is captured from
>>> the onsend_route. Then you can compare against siptrace content and see if
>>> they match or is there something different captured.
>>>
>>> You need to call sip_trace() in the onsend_route, the trace_flag capture
>>> method does not work there.
>>>
>>> Cheers,
>>>
>>> Henning
>>> Am 25.08.19 um 18:01 schrieb Salah Ahmed:
>>>
>>> Hello Daniel,
>>>
>>> Thanks for your reply. We want this not to modify the reply message, we
>>> just want to invoke sip_trace from onsend_route. Actually we want to trace
>>> all sip messages in between Kamailio and UAC. Right now we can easily grab
>>> all requests using onsend_route. We also set the core parameter 
>>> onsend_route_reply
>>> = yes ,This started capturing replies, but those are UAS to Kamailio
>>> side replies. For debug I added xlog in the onsend_route and print the
>>> reply messages. I am not sure, is that sip_trace method issue or the
>>> onsend_route issue. Please guide me is there anything else I can do for it.
>>>
>>> Thanks,
>>> Salah
>>>
>>>
>>> On Fri, Aug 23, 2019 at 2:29 PM Salah Ahmed <txru...@gmail.com> wrote:
>>>
>>>> Hello Henning,
>>>>
>>>> Is there anything wrong what we want to do?
>>>>
>>>> Thanks,
>>>> Salah
>>>>
>>>> On Thu, Aug 22, 2019 at 2:56 PM Salah Ahmed <txru...@gmail.com> wrote:
>>>>
>>>>> Hello Henning,
>>>>>
>>>>> Yes this is correct, this reply came from UAS. We got this correctly.
>>>>> But we want to get, which kamailio sent to UAC side.
>>>>>
>>>>> This following reply, we want to get by onreply_route
>>>>>
>>>>>  3(23) DEBUG: <core> [core/msg_translator.c:2306]:
>>>>> generate_res_buf_from_sip_res(): copied size: orig:130, new: 16, rest: 773
>>>>> msg=
>>>>> SIP/2.0 200 OK
>>>>> Via: SIP/2.0/UDP 172.32.100.100:5055;branch=z9hG4bK-254-1-0
>>>>> Record-Route: <sip:172.32.0.6:5060;lr;ftag=1>
>>>>> Call-ID: T1_MYSER
>>>>> From: <sip:caller@172.32.100.100>;tag=1
>>>>> To: "callee" <sip:3228090000@172.32.0.6
>>>>> >;tag=6fb31703-d630-4140-a41b-7270cdcae85b
>>>>> CSeq: 1 INVITE
>>>>> Server: MYX Callcontrol
>>>>> Contact: <sip:172.32.10.70:5060>
>>>>> Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL,
>>>>> UPDATE, REGISTER, MESSAGE, REFER
>>>>> Supported: timer, replaces, norefersub
>>>>> Remote-Party-ID: <sip:s@172.32.0.6>;privacy=off;screen=no
>>>>> Content-Type: application/sdp
>>>>> Content-Length:   178
>>>>>
>>>>> v=0
>>>>> o=- 53655765 2353687639 IN IP4 172.32.10.70
>>>>> s=session
>>>>> c=IN IP4 172.32.10.70
>>>>> t=0 0
>>>>> m=audio 10006 RTP/AVP 0
>>>>> a=rtpmap:0 PCMU/8000
>>>>> a=ptime:20
>>>>> a=maxptime:150
>>>>> a=sendrecv
>>>>>
>>>>> Thanks,
>>>>> Salah
>>>>>
>>>>> On Thu, Aug 22, 2019 at 2:52 PM Henning Westerholt <h...@skalatan.de>
>>>>> wrote:
>>>>>
>>>>>> (moved the discussion to user list)
>>>>>>
>>>>>> Hello Salah,
>>>>>>
>>>>>> I see the this output in the log message:
>>>>>>
>>>>>>  6(26) INFO: <script>: on_reply_route [SIP/2.0 200 OK
>>>>>> Via: SIP/2.0/UDP
>>>>>> 172.32.0.6;rport=5060;received=172.32.0.6;branch=z9hG4bKe68a.99dc492fe74dcfe1017828521a5fa362.0
>>>>>>
>>>>>>  2(22) INFO: <script>: on_reply_route [SIP/2.0 100 Trying
>>>>>> Via: SIP/2.0/UDP
>>>>>> 172.32.0.6;rport=5060;received=172.32.0.6;branch=z9hG4bK178a.79cddb135aabfc42736fd9e9fd826ba8.0
>>>>>>
>>>>>> and so on.. So you are seeing the replies correctly, or I wrong?
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Henning
>>>>>> Am 22.08.19 um 21:29 schrieb Salah Ahmed:
>>>>>>
>>>>>> Hello Henning,
>>>>>>
>>>>>> We already added xlog in the onreply_route and found all messages in
>>>>>> between kamailio and UAS. The attached log files in first email has those
>>>>>> logs. If any other specific log needed I am here to provide them.
>>>>>>
>>>>>> Thanks,
>>>>>> Salah
>>>>>>
>>>>>> On Thu, Aug 22, 2019 at 2:24 PM Henning Westerholt <h...@skalatan.de>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello Salah,
>>>>>>>
>>>>>>> ok, see if you are able to output some easy log with "xlog" in this
>>>>>>> route, to make sure there is no cfg problem somewhere.
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Henning
>>>>>>> Am 22.08.19 um 21:15 schrieb Salah Ahmed:
>>>>>>>
>>>>>>> Hello Henning,
>>>>>>>
>>>>>>> Thanks for quick reply, We armed the t_on_reply just before
>>>>>>> t_relay() in the route block.
>>>>>>>
>>>>>>>         t_on_reply("LOGRPL");
>>>>>>>         if (!t_relay()) {
>>>>>>>                 sl_reply_error();
>>>>>>>         }
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Salah
>>>>>>>
>>>>>>> On Thu, Aug 22, 2019 at 2:03 PM Henning Westerholt <h...@skalatan.de>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hello Salah,
>>>>>>>>
>>>>>>>> the replies are going from the UAS to the UAC over Kamailo as a
>>>>>>>> proxy, with the exception of the hop-by-hop 100.
>>>>>>>>
>>>>>>>> So you should see the 200 OK in the Kamailio in reply_route and
>>>>>>>> onreply_route. Maybe you can check if you armed the onreply_route with
>>>>>>>> t_on_reply for the INVITE routing.
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>>
>>>>>>>> Henning
>>>>>>>> Am 22.08.19 um 19:50 schrieb Salah Ahmed:
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> We facing an issue on capturing sip message in Kamailio(Version:
>>>>>>>> 5.2.3). The scenario is very simple.
>>>>>>>>
>>>>>>>> UAC                    Kamailio                UAS
>>>>>>>>  |--------INVITE--------->|                     |
>>>>>>>>  |                        |-------INVITE------->|
>>>>>>>>  |                        |<------100 Trying----|
>>>>>>>>  |<-------100 Trying------|                     |
>>>>>>>>  |                        |<------200 Ok--------|
>>>>>>>>  |<-------200 Ok----------|                     |
>>>>>>>>
>>>>>>>> In this simple scenario, we can't catch any reply messages in
>>>>>>>> between the Kamailio and UAC. We have tried reply_route, onreply_route,
>>>>>>>> and onsend_route. But no one work to grep that reply on that side.
>>>>>>>> onsend_route was bad try as its only for forwarded reply message. Is 
>>>>>>>> there
>>>>>>>> any other magic to capture those replies. A debug=3 log message 
>>>>>>>> attached
>>>>>>>> here.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Salah
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Kamailio (SER) - Development Mailing 
>>>>>>>> Listsr-dev@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
>>>>>>>>
>>>>>>>> --
>>>>>>>> Henning Westerholt - https://skalatan.de/blog/
>>>>>>>> Kamailio services - https://skalatan.de/services
>>>>>>>>
>>>>>>>> --
>>>>>>> Henning Westerholt - https://skalatan.de/blog/
>>>>>>> Kamailio services - https://skalatan.de/services
>>>>>>>
>>>>>>> --
>>>>>> Henning Westerholt - https://skalatan.de/blog/
>>>>>> Kamailio services - https://skalatan.de/services
>>>>>>
>>>>>>
>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing 
>>> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>> --
>>> Henning Westerholt - https://skalatan.de/blog/
>>> Kamailio services - https://skalatan.de/services
>>>
>>> --
>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- 
>> www.linkedin.com/in/miconda
>>
>> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to