[SR-Users] no event received for call disconnection

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 20 10:16:04 CET 2017


Thanks for testing and reporting. I will backport to branch 5.0, so next
5.0.x release will have these fixes.

Cheers,
Daniel


On 20.11.17 09:57, Aleksandar Sosic wrote:
> Everything is working now,
>
> thanks for your help and quick fix!
> --
> Aleksandar Sosic
> mail: alex.sosic at timenet.it
> skype: alex.sosic
> cell: +385 91 2505 146
>
>
> On Mon, Nov 6, 2017 at 11:34 AM, Daniel-Constantin Mierla
> <miconda at gmail.com> wrote:
>> Hello,
>>
>> only master branch got the patches, you have to install from:
>>
>> http://deb.kamailio.org/kamailiodev-nightly
>>
>> See the wiki for more about available debian/ubuntu repos:
>>
>>   -
>> https://www.kamailio.org/wiki/packages/debs#kamailio_development_master_branch
>>
>> If all works fine, then I will backport to 5.0. I didn't want to break
>> stable branch 5.0 without any testing, as I don't have a testbed to
>> replicate your use case.
>>
>> Cheers,
>> Daniel
>>
>>
>> On 06.11.17 11:24, Aleksandar Sosic wrote:
>>> Does the last debian jessie package contains such patch?
>>>
>>> in my /etc/apt/sources.list:
>>> deb http://deb.kamailio.org/kamailio50 xenial main
>>> deb-src http://deb.kamailio.org/kamailio50 xenial main
>>>
>>> Thanks,
>>> --
>>> Aleksandar Sosic
>>> mail: alex.sosic at timenet.it
>>> skype: alex.sosic
>>> cell: +385 91 2505 146
>>>
>>>
>>> On Fri, Nov 3, 2017 at 9:26 AM, Daniel-Constantin Mierla
>>> <miconda at gmail.com> wrote:
>>>> Hello,
>>>>
>>>> can you try with latest master? I just pushed a patch that should handle
>>>> this case. Let me know if works or not.
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>> On 01.11.17 11:57, Aleksandar Sosic wrote:
>>>>> Thank you Daniel!
>>>>> --
>>>>> Aleksandar Sosic
>>>>> mail: alex.sosic at timenet.it
>>>>> skype: alex.sosic
>>>>> cell: +385 91 2505 146
>>>>>
>>>>>
>>>>> On Wed, Nov 1, 2017 at 10:39 AM, Daniel-Constantin Mierla
>>>>> <miconda at gmail.com> wrote:
>>>>>> Hello,
>>>>>>
>>>>>> ok, now the cfg execution flow is easier to understand. The evapi
>>>>>> receiver was not designed to write back directly, I will try to find a
>>>>>> solution for this case.
>>>>>>
>>>>>> Cheers,
>>>>>> Daniel
>>>>>>
>>>>>> On 31.10.17 15:03, Aleksandar Sosic wrote:
>>>>>>> Hi Daniel,
>>>>>>>
>>>>>>> so the kamailio.conf sections that matters are here:
>>>>>>> https://gist.github.com/alexsosic/5a33d314d2db1832fd04166fe6615227
>>>>>>>
>>>>>>> Thanks for your time!
>>>>>>> --
>>>>>>> Aleksandar Sosic
>>>>>>> mail: alex.sosic at timenet.it
>>>>>>> skype: alex.sosic
>>>>>>> cell: +385 91 2505 146
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Oct 31, 2017 at 12:51 PM, Daniel-Constantin Mierla
>>>>>>> <miconda at gmail.com> wrote:
>>>>>>>> It is a bit hard to guess the logic you have there, but seems like
>>>>>>>> cgrates sends a disconnect request via event api, which via some actions
>>>>>>>> triggers a dialog end, which then wants to send back an event to cgrates
>>>>>>>> that call is ending? Like a loop back communication with evapi receiver ...
>>>>>>>>
>>>>>>>> Maybe you can share the config file (or the relevant parts).
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Daniel
>>>>>>>>
>>>>>>>> On 31.10.17 12:18, Aleksandar Sosic wrote:
>>>>>>>>> 17(114) NOTICE: evapi [evapi_dispatch.c:339]: evapi_recv_client(): {0}
>>>>>>>>> [127.0.0.1:41154] - received
>>>>>>>>> [99:{"Event":"CGR_SESSION_DISCONNECT","HashEntry":"715","HashId":"1885","Reason":"-INSUFFICIENT_FUNDS"},]
>>>>>>>>> (103) (0)
>>>>>>>>>
>>>>>>>>> It seems like an evapi recieved command.
>>>>>>>>> That triggers that route.
>>>>>>>>>
>>>>>>>>> After that I do have this errors in kamailio logs:
>>>>>>>>> 17(114) ERROR: <core> [core/parser/parse_from.c:107]:
>>>>>>>>> parse_from_uri(): failed to parse From uri
>>>>>>>>> 17(114) ERROR: pv [pv_core.c:414]: pv_get_xto_attr(): cannot parse From URI
>>>>>>>>> 17(114) ERROR: <core> [core/parser/parse_to.c:81]: parse_to_uri():
>>>>>>>>> failed to parse To uri
>>>>>>>>> 17(114) ERROR: pv [pv_core.c:408]: pv_get_xto_attr(): cannot parse To URI
>>>>>>>>> --
>>>>>>>>> Aleksandar Sosic
>>>>>>>>> mail: alex.sosic at timenet.it
>>>>>>>>> skype: alex.sosic
>>>>>>>>> cell: +385 91 2505 146
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Oct 31, 2017 at 12:04 PM, Daniel-Constantin Mierla
>>>>>>>>> <miconda at gmail.com> wrote:
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> when is the route[CGR_SESSION_DISCONNECT] executed? In other words,
>>>>>>>>>> where do you have route(CGR_SESSION_DISCONNECT) in your config or is
>>>>>>>>>> there any modparam with CGR_SESSION_DISCONNECT in it?
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> Daniel
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 31.10.17 11:45, Aleksandar Sosic wrote:
>>>>>>>>>>> Hi Daniel,
>>>>>>>>>>>
>>>>>>>>>>> It's done by this cgrates route:
>>>>>>>>>>> ```
>>>>>>>>>>> # CGRateS request for session disconnect
>>>>>>>>>>> route[CGR_SESSION_DISCONNECT] {
>>>>>>>>>>>   json_get_field("$evapi(msg)", "HashEntry", "$var(HashEntry)");
>>>>>>>>>>>   json_get_field("$evapi(msg)", "HashId", "$var(HashId)");
>>>>>>>>>>>   json_get_field("$evapi(msg)", "Reason", "$var(Reason)");
>>>>>>>>>>>   jsonrpc_exec('{"jsonrpc":"2.0","id":1,
>>>>>>>>>>> "method":"dlg.end_dlg","params":[$(var(HashEntry){s.rm,"}),$(var(HashId){s.rm,"})]}');
>>>>>>>>>>> }
>>>>>>>>>>> ```
>>>>>>>>>>>
>>>>>>>>>>> It executes a dlg.end_dlg via jsonrpc.
>>>>>>>>>>> --
>>>>>>>>>>> Aleksandar Sosic
>>>>>>>>>>> mail: alex.sosic at timenet.it
>>>>>>>>>>> skype: alex.sosic
>>>>>>>>>>> cell: +385 91 2505 146
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Oct 30, 2017 at 5:57 PM, Daniel-Constantin Mierla
>>>>>>>>>>> <miconda at gmail.com> wrote:
>>>>>>>>>>>> Hello,
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 30.10.17 17:29, Aleksandar Sosic wrote:
>>>>>>>>>>>>> Hi Everyone,
>>>>>>>>>>>>>
>>>>>>>>>>>>> we're trying to implement cgrates in our kamailio nodes.
>>>>>>>>>>>>> Everything is working fine except for the fact that kamailio is not
>>>>>>>>>>>>> signaling the call end to cgrates for prepaid users... The versions,
>>>>>>>>>>>>> logs and confs are:
>>>>>>>>>>>>>
>>>>>>>>>>>>> ```
>>>>>>>>>>>>> # kamailio -v
>>>>>>>>>>>>> version: kamailio 5.0.3 (x86_64/linux)
>>>>>>>>>>>>> flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS,
>>>>>>>>>>>>> DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC,
>>>>>>>>>>>>> Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX,
>>>>>>>>>>>>> FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR,
>>>>>>>>>>>>> USE_DST_BLACKLIST, HAVE_RESOLV_RES
>>>>>>>>>>>>> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
>>>>>>>>>>>>> MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
>>>>>>>>>>>>> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
>>>>>>>>>>>>> id: unknown
>>>>>>>>>>>>> compiled with gcc 5.3.1
>>>>>>>>>>>>> ```
>>>>>>>>>>>>>
>>>>>>>>>>>>> ```
>>>>>>>>>>>>> # cgr-engine --version
>>>>>>>>>>>>> CGRateS 0.9.1~rc8 git+15a0793 (2017-10-23T12:15:40+02:00)
>>>>>>>>>>>>> ```
>>>>>>>>>>>>>
>>>>>>>>>>>>> The kamailio conf regarding our problem is:
>>>>>>>>>>>>> ```
>>>>>>>>>>>>> # Inform CGRateS about CALL_END (stop debit loops, perform accounting
>>>>>>>>>>>>> if desired in this way)
>>>>>>>>>>>>> route[CGR_CALL_END] {
>>>>>>>>>>>>>   if $sht(cgrconn=>cgr) == $null {
>>>>>>>>>>>>>     xlog("Charging controller unreachable");
>>>>>>>>>>>>>     exit;
>>>>>>>>>>>>>   }
>>>>>>>>>>>>>   $var(callDur) = $TS - $dlg(start_ts);
>>>>>>>>>>>>>   evapi_relay("{\"event\":\"CGR_CALL_END\",
>>>>>>>>>>>>>     \"callid\":\"$dlg(callid)\",
>>>>>>>>>>>>>     \"from_tag\":\"$dlg(from_tag)\",
>>>>>>>>>>>>>     \"cgr_reqtype\":\"$dlg_var(cgrReqType)\",
>>>>>>>>>>>>>     \"cgr_tenant\":\"$dlg_var(cgrTenant)\",
>>>>>>>>>>>>>     \"cgr_account\":\"$dlg_var(cgrAccount)\",
>>>>>>>>>>>>>     \"cgr_destination\":\"$dlg_var(cgrDestination)\",
>>>>>>>>>>>>>     \"cgr_answertime\":\"$dlg(start_ts)\",
>>>>>>>>>>>>>     \"cgr_duration\":\"$var(callDur)\",
>>>>>>>>>>>>>     \"cgr_supplier\":\"$dlg_var(cgrSupplier)\",
>>>>>>>>>>>>>     \"cgr_disconnectcause\":\"$T_reply_code\"}");
>>>>>>>>>>>>> }
>>>>>>>>>>>>> ```
>>>>>>>>>>>>>
>>>>>>>>>>>>> The kamailio logs:
>>>>>>>>>>>>>
>>>>>>>>>>>>> ```
>>>>>>>>>>>>> 17(114) ERROR: evapi [evapi_dispatch.c:707]: _evapi_relay(): failed to
>>>>>>>>>>>>> pass the pointer to evapi dispatcher
>>>>>>>>>>>>> 17(114) ERROR: evapi [evapi_mod.c:261]: w_evapi_relay(): failed to
>>>>>>>>>>>>> relay event: {"event":"CGR_CALL_END",
>>>>>>>>>>>>> [...]
>>>>>>>>>>>> does this happen on BYE or on dialog timeout?
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>> Daniel
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Daniel-Constantin Mierla
>>>>>>>>>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>>>>>>>>>> Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com
>>>>>>>>>>>> Kamailio World Conference - www.kamailioworld.com
>>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Daniel-Constantin Mierla
>>>>>>>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>>>>>>>> Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com
>>>>>>>>>> Kamailio World Conference - www.kamailioworld.com
>>>>>>>>>>
>>>>>>>> --
>>>>>>>> Daniel-Constantin Mierla
>>>>>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>>>>>> Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com
>>>>>>>> Kamailio World Conference - www.kamailioworld.com
>>>>>>>>
>>>>>> --
>>>>>> Daniel-Constantin Mierla
>>>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>>>> Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com
>>>>>> Kamailio World Conference - www.kamailioworld.com
>>>>>>
>>>> --
>>>> Daniel-Constantin Mierla
>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>> Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com
>>>> Kamailio World Conference - www.kamailioworld.com
>>>>
>> --
>> Daniel-Constantin Mierla
>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>> Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - www.asipto.com
>> Kamailio World Conference - www.kamailioworld.com
>>

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com




More information about the sr-users mailing list