[OpenSIPS-Users] how to catch hangup event inside opensips

Liviu Chircu liviu at opensips.org
Wed Jan 25 08:08:40 EST 2017

There are several ways of doing this, to name a few:

- catch CDR events (E_ACC_CDR) [1] in the event_route, and go from 
there. This is the most straight-forward solution, giving you lots of 
information to work with. However, you must be using the "acc" module in 
order for it to work.

- catch dialog state change events (E_DLG_STATE_CHANGED) [2] in the 
event_route, go from there. The idea is to detect when a dialog goes 
from state 4 (confirmed) -> 5 (deleted). A problem with this approach 
might be the limited amount of information available in the event route.

- simply catch all BYE requests in your OpenSIPS script, and go from 
there. The tricky part with this approach is to not forget about the 
auto-generated BYEs (calls cut by OpenSIPS), by also doing some handling 
inside the "local route".

[1]: http://www.opensips.org/html/docs/modules/2.3.x/acc#id295391
[2]: http://www.opensips.org/html/docs/modules/2.3.x/dialog.html#id297615


Liviu Chircu
OpenSIPS Developer

On 25.01.2017 14:52, Khalil Khamlichi wrote:
> sorry the expression "run a route" was misleading, actually we are 
> working on a dashboard, we need to catch events happening inside 
> opensips to feed our counters, we hope to be able to catch hangup 
> event and probably the sip_code so that we can have counters for every 
> sip code specific to every gateway. the other way around this is to 
> catch the cdr insert and feed counters.
> On Wed, Jan 25, 2017 at 12:32 PM, Stefano Pisani 
> <stefano.pisani at omnianet.it <mailto:stefano.pisani at omnianet.it>> wrote:
>     please explain better
>     Il 25 Gennaio 2017 13:24:57 CET, Khalil Khamlichi
>     <khamlichi.khalil at gmail.com <mailto:khamlichi.khalil at gmail.com>>
>     ha scritto:
>         there is one more question we still struggling with, how to
>         run a route at each hangup, we never found any way to do it
>         inside opensips. right now we catching the event upon cdr
>         insert in db.
>     -- Inviato dal mio cellulare Android con K-9 Mail.
>     _______________________________________________
>     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>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

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

More information about the Users mailing list