[SR-Users] Send SIP Info within a dialog using $uac_req(method)="INFO"

Daniel-Constantin Mierla miconda at gmail.com
Tue Dec 6 08:46:40 CET 2016


Hello,


you can reorganize the config in order to execute t_relay() for ACK,
then you can do your stuff after it.


if is ack {

  t_relay();

  custom stuff

  exit;

}


Cheers,
Daniel


On 05/12/2016 15:03, Jonathan Hunter wrote:
>
> Hello,
>
>
> I had been testing with ACK within that route, but in the ideal
> scenario I want to proxy the ACK, then follow that with the SIP INFO,
> where as at the moment it sends at same time, once it matches.
>
>
> I wondered if there is an event route I can trigger once I know the
> ACK has been relayed?
>
>
> Thanks
>
>
> Jon
>
>
>
> ------------------------------------------------------------------------
> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
> *Sent:* 05 December 2016 13:54
> *To:* Jonathan Hunter; Kamailio SER - Users Mailing List
> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
> $uac_req(method)="INFO"
>  
>
> Hello,
>
>
> the ACK for requests within dialogs is routed via route[WITHINDLG], if
> it has a Route header -- also you can check if it belongs to an dialog
> -- dialog module should export a function for that.
>
>
> Cheers,
> Daniel
>
>
> On 05/12/2016 14:13, Jonathan Hunter wrote:
>>
>> Hello,
>>
>>
>> Ok thanks for that, it works perfectly.
>>
>>
>> I am generating the SIP INFO message, on receipt of a 200ok, which is
>> being triggered by the event_route[dialog:start].
>>
>>
>> One last thing, is it possible to trigger /capture the event of the
>> ACK being received for the 200 ok ?
>>
>>
>> As ideally I want to send SIP INFO after the ACK has been sent,
>> however currently I am triggering on receipt of the 200ok, so dialog
>> is started.
>>
>>
>> Can I have;
>>
>>
>> INVITE--->
>>
>> <---200OK
>>
>> ACK--->
>>
>> INFO---->
>>
>>
>> So in effect RELAY the ACK, then trigger this SIP INFO  to be sent?
>>
>>
>> Thanks
>>
>>
>> Jon
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
>> *Sent:* 05 December 2016 10:32
>> *To:* Jonathan Hunter; Kamailio SER - Users Mailing List
>> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
>> $uac_req(method)="INFO"
>>  
>>
>> Hello,
>>
>>
>> all the headers must be in a single parameter, I see that you provide
>> headers one by one in the params array. Try:
>>
>>
>> jsonrpc_exec('
>> {
>>  "jsonrpc":"2.0",
>>  "method":"tm.t_uac_start",
>>  "params": [
>>     "INFO",
>>     "$dlg(to_uri)",
>>     ".",
>>     ".",
>>    
>> "From:$var(testjon)\r\nTo:$var(testjon2)\r\nContact:$var(testjon4)\r\nContent-Type:
>> application/json\r\nContent-Length: 0\r\n"
>>   ]
>> }
>> ');
>>
>> Cheers,
>> Daniel
>>
>> On 01/12/2016 17:12, Jonathan Hunter wrote:
>>> Hi Daniel, 
>>>
>>> I am trying tm.t_uac_start and its stating Content-Type Missing, I
>>> have tried to add to params but it doesnt like it, where should it
>>> be defined?
>>>
>>> Command below;
>>>
>>>
>>> jsonrpc_exec('{"jsonrpc":"2.0","method":"tm.t_uac_start","params":
>>> ["INFO",
>>> "$dlg(to_uri)",".",".","From:$var(testjon)\r\n","To:$var(testjon2)\r\n","Contact:$var(testjon4)\r\n","Content-Type:
>>> application/json\r\n","Content-Length: 0\r\n"]}');
>>>
>>> And logs;
>>>
>>> Dec  1 16:09:15 POC_ProxyA /usr/sbin/kamailio[11883]: INFO:
>>> <script>: getting here Content-Type missing
>>> Dec  1 16:09:15 POC_ProxyA /usr/sbin/kamailio[11883]: INFO:
>>> <script>: getting here
>>> {"jsonrpc":"2.0","error":{"code":-32000,"message":"Execution Error"}}
>>>
>>> Thanks
>>>
>>>
>>> Jon
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
>>> *Sent:* 01 December 2016 12:31
>>> *To:* Jonathan Hunter; Kamailio SER - Users Mailing List
>>> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
>>> $uac_req(method)="INFO"
>>>  
>>>
>>> Hello,
>>>
>>>
>>> tm.t_uac_start is another rpc command than what was tried before,
>>> this one doesn't do async operation.
>>>
>>> Cheers,
>>> Daniel
>>>
>>> On 01/12/2016 13:28, Jonathan Hunter wrote:
>>>>
>>>> Hello,
>>>>
>>>>
>>>> I am currently still using the exec module, so within the .cfg
>>>> file, as when using jsonrpc-s its coming up with the async command
>>>> issue again, I presume this will still be the case?
>>>>
>>>>
>>>> Ok I will try with the combinations you mention.
>>>>
>>>>
>>>> Many thanks
>>>>
>>>>
>>>> Jon
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
>>>> *Sent:* 01 December 2016 12:24
>>>> *To:* Jonathan Hunter; Kamailio SER - Users Mailing List
>>>> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
>>>> $uac_req(method)="INFO"
>>>>  
>>>>
>>>> Hello,
>>>>
>>>>
>>>> are you still trying with MI command via kamctl? Not with the
>>>> jsonrpc-s module and tm.t_uac_start?
>>>>
>>>>
>>>> When double quotes disappear is likely due to command line
>>>> interpreter, so you need to put two of them for each one you have
>>>> now, then ones than need to stay should be with more backslashes.
>>>>
>>>>
>>>> Also, you can try to use single quotes to enclose the parameter
>>>> values and let the double quotes in the content of the parameter.
>>>>
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>> On 30/11/2016 15:38, Jonathan Hunter wrote:
>>>>> Hi,
>>>>>
>>>>> I am just testing with the mi t_uac_dlg command, and I am trying
>>>>> to create an additional header, which is sent in the SIP INFO
>>>>> message and actually contains double quotes.
>>>>>
>>>>> So in my kamailio.cfg script file I set the variable;
>>>>>
>>>>>
>>>>> $var(testjon8) = "p1=\"STOP\"";
>>>>>
>>>>> xlog("L_INFO","We are going to try and use $var(testjon8)\n");
>>>>>
>>>>> And when seeing in the logs I see it states;
>>>>>
>>>>> We are going to try and use p1="STOP"
>>>>>
>>>>> And p1="STOP" is exactly what I want.
>>>>>
>>>>> However when I generate the SIP INFO message, and check on the
>>>>> wire using wireshark I see;
>>>>>
>>>>> Event:p1=STOP
>>>>>
>>>>> So it doesnt have the double quotes I would like.
>>>>>
>>>>> How can I escape them so the t_uac_dlg command includes them?
>>>>>
>>>>> The portion where this header is generated in the command is;
>>>>>
>>>>>
>>>>> exec_avp("kamctl mi t_uac_dlg INFO $dlg(to_uri) . .
>>>>> \\\"From:'$var(testjon)'\"\\r\\nTo:$var(testjon2)\\r\\nCall-ID:$var(testjon3)\\r\\nAllow:$var(Allow)\\r\\nContact:$var(testjon4)\\r\\nEvent:$var(testjon8)\\r\\n\\\"\"",
>>>>> "$avp(test)");
>>>>>
>>>>>
>>>>>
>>>>> And also running debug I see it as Event:p1="STOP"\r\n\""
>>>>>
>>>>>
>>>>> Can you tell me how I can escape " so its actually within the SIP
>>>>> header itself?
>>>>>
>>>>> Many thanks
>>>>>
>>>>> Jon
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>> *From:* sr-users <sr-users-bounces at lists.sip-router.org> on behalf
>>>>> of Jonathan Hunter <hunterj91 at hotmail.com>
>>>>> *Sent:* 25 November 2016 18:55
>>>>> *To:* Kamailio SER - Users Mailing List; miconda at gmail.com
>>>>> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
>>>>> $uac_req(method)="INFO"
>>>>>  
>>>>>
>>>>> Hi Daniel,
>>>>>
>>>>>
>>>>> Great thanks very much, will give it a try.
>>>>>
>>>>>
>>>>> Jon
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
>>>>> *Sent:* 22 November 2016 18:46
>>>>> *To:* Jonathan Hunter; Kamailio SER - Users Mailing List
>>>>> *Subject:* Re: [SR-Users] Send SIP Info within a dialog using
>>>>> $uac_req(method)="INFO"
>>>>>  
>>>>>
>>>>> Hello,
>>>>>
>>>>>
>>>>> got a bit of time to look at the code and discovered that there is
>>>>> a rpc command tm.t_uac_start added by ser guys that might get you
>>>>> moving forward. It is not waiting for the reply of the generated
>>>>> request and you can use it with json rpc exec function in the
>>>>> config, so it avoids using exec.
>>>>>
>>>>>
>>>>> Can you give it a try?
>>>>>
>>>>>
>>>>> Some documentation can be found in the comments of the function
>>>>> used by this command:
>>>>>
>>>>>   -
>>>>> https://github.com/kamailio/kamailio/blob/master/modules/tm/rpc_uac.c#L399
>>>>>
>>>>> Cheers,
>>>>> Daniel
>>>>>
>>>>>
>>>>> On 22/11/2016 18:35, Jonathan Hunter wrote:
>>>>>>
>>>>>> Hi Daniel,
>>>>>>
>>>>>>
>>>>>> Thanks here you go;
>>>>>>
>>>>>>
>>>>>> [root at POC_ProxyA kamailio]# kamctl mi t_uac_dlg INFO
>>>>>> sip:3003 at 193.144.1.112 . udp:10.70.1.136:5060  
>>>>>>  \"From:sip:1234 at 8.8.8.8"\r\nTo:sip:3003 at 193.144.1.112\r\nContact:sip:daemon at 8.8.8.8\r\n\""
>>>>>> 404 Invalid local socket
>>>>>> [root at POC_ProxyA kamailio]# VERBOSE=1 kamctl mi t_uac_dlg INFO
>>>>>> sip:3003 at 193.144.1.112 . udp:10.70.1.136:5060  
>>>>>>  \"From:sip:1234 at 8.8.8.8"\r\nTo:sip:3003 at 193.144.1.112\r\nContact:sip:daemon at 8.8.8.8\r\n\""
>>>>>> database engine 'MYSQL' loaded
>>>>>> Control engine 'FIFO' loaded
>>>>>> entering fifo_cmd t_uac_dlg INFO sip:3003 at 193.144.1.112 .
>>>>>> udp:10.70.1.136:5060 "From:sip:1234 at 8.8.8.8
>>>>>> To:sip:3003 at 193.144.1.112
>>>>>> Contact:sip:daemon at 8.8.8.8
>>>>>> "
>>>>>> 404 Invalid local socket
>>>>>> FIFO command was:
>>>>>> :t_uac_dlg:kamailio_receiver_23469
>>>>>> INFO
>>>>>> sip:3003 at 193.144.1.112
>>>>>> .
>>>>>> udp:10.70.1.136:5060
>>>>>> "From:sip:1234 at 8.8.8.8
>>>>>> To:sip:3003 at 193.144.1.112
>>>>>> Contact:sip:daemon at 8.8.8.8
>>>>>> "
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> Jon
>>>>>>
>>>>> Daniel-Constantin Mierla
>>>>> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>>> Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com
>>>>
>>>> -- 
>>>> Daniel-Constantin Mierla
>>>> twitter.com/miconda -- linkedin.com/in/miconda
>>>> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
>>>
>>> -- 
>>> Daniel-Constantin Mierla
>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
>>
>> -- 
>> Daniel-Constantin Mierla
>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
>
> -- 
> Daniel-Constantin Mierla
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20161206/d8c892b6/attachment.html>


More information about the sr-users mailing list