[OpenSIPS-Users] How can I retrieve the callID and start time for a call inside event_route[E_RTPPROXY_DTMF] {

Bogdan-Andrei Iancu bogdan at opensips.org
Wed Sep 14 14:42:29 UTC 2022


There are several options here, unfortunately none really simple. Here 
is one:

a) after creating the dialog (at initial INVITE time), save the Call-id 
into a $dlg_val [1]
     $dlg_val(my_callid) = $ci;

b) in event route, use load_dialog_ctx() [2] - do NOT forget to pair it 
with the unload function
     load_dialog_ctx("$param(id)", "did");
     $var(callid) = $dlg_val(my_callid);
load_dialog_ctx();
     ....
     # you have the callid into $var(callid) for further processing

[1] https://opensips.org/html/docs/modules/3.2.x/dialog.html#pv_dlg_val
[2] 
https://opensips.org/html/docs/modules/3.2.x/dialog.html#func_load_dialog_ctx


Another option may be the usage of local cache to store the SIP callid 
under the dialog ID as key, at INVITE time:
https://opensips.org/html/docs/modules/3.2.x/dialog.html#pv_DLG_did
https://www.opensips.org/Documentation/Script-CoreFunctions-3-2#cache_store
And in event route simply use the cache_fetch() with the dialog ID as 
key also.

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Summit 27-30 Sept 2022, Athens
   https://www.opensips.org/events/Summit-2022Athens/

On 9/14/22 5:31 PM, Saint Michael wrote:
> Is there way to obtain the SIP Call ID from the "id" or when is_callid=0?
> if I save the callID on a global variable, will it be visible 
> around all the code?
> Sorry I am still learning the ropes.
>
>
>
>
> On Wed, Sep 14, 2022 at 9:38 AM Bogdan-Andrei Iancu 
> <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>
>     Hi,
>
>     As per docs [1], you have in event_route :
>
>      id - represents the identifier of the call for which that event
>     was received.
>
>      is_callid - is 0 if the id parameter represents the Dialog ID, or
>     1 if it is a callid.
>
>     [1]
>     https://opensips.org/html/docs/modules/3.2.x/rtpproxy.html#event_E_RTPPROXY_DTMF
>     <https://opensips.org/html/docs/modules/3.2.x/rtpproxy.html#event_E_RTPPROXY_DTMF>
>
>     Regards,
>
>     Bogdan-Andrei Iancu
>
>     OpenSIPS Founder and Developer
>        https://www.opensips-solutions.com  <https://www.opensips-solutions.com>
>     OpenSIPS Summit 27-30 Sept 2022, Athens
>        https://www.opensips.org/events/Summit-2022Athens/  <https://www.opensips.org/events/Summit-2022Athens/>
>
>     On 9/14/22 10:46 AM, Saint Michael wrote:
>>
>>         My goal is to close the call as soon as the callee presses
>>         any DTMF
>>
>>     when any DTMF is detected,  then I need to access the callID
>>     variable, $ci
>>     but it's nowhere to be found
>>     Also I need $avp(start_time) and $avp(duration)
>>     I am at a loss as to how to retrieve this information. The call
>>     is connected
>>     I need to fire a database query to close the call.
>>     I imagine that when the call got connected, some variable stored
>>     that unix-time .
>>     But it does not seem to be available in this part of the code.
>>     Philip
>>
>>
>>
>>
>>
>>
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.opensips.org  <mailto:Users at lists.opensips.org>
>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users  <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20220914/f4538354/attachment.html>


More information about the Users mailing list