call_control, dialog and BYE messages patch

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

call_control, dialog and BYE messages patch

Mauro Davì

Hi All,

 

using the callcontrol module I see that if the opensips server goes down, on the next start the BYE message aren’t sent to the call control module (i.e. the stop message).

 

Attached there is the dialog module patch.

 

I modified the register_dlgcb (dialog, type, cb, param, free_param_cb) function in this way:

 

If the dialog parameter is null and the type isn’t equal to DIALOG_CREATED, the callback function is registered to all the active dialogs.

 

So in the call control module, in the mod_init function I simply added this new lines:

 

    if (dlg_api.register_dlgcb(NULL, DLGCB_RESPONSE_FWDED, __dialog_replies, NULL, NULL) != 0) {

        LM_CRIT("cannot register callback for dialog confirmation\n");

        return -1;

    }

 

    if (dlg_api.register_dlgcb(NULL, DLGCB_TERMINATED | DLGCB_FAILED | DLGCB_EXPIRED | DLGCB_DESTROY, __dialog_ended, (void*)CCActive, NULL) != 0) {

        LM_CRIT("cannot register callback for dialog termination\n");

        return -1;

    }

 

Now the BYE messages are sent to the call control module (stop messages) also if the opensips server is previously killed.

 

I don’t know if this is the best solution, but it is a solution J

 

Regards,

      MD


_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

dialogpatch.tgz (756 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: call_control, dialog and BYE messages patch

Bogdan-Andrei Iancu
Hi Mauro,

I think a better approach is to use the DLGCB_LOADED callback type. This
is called when a dialog is restored from DB (at startup) and it is
called per dialog. So the "callcontrol" module could register such
callback and use it to register further whatever other callbacks are needed.

Maybe Dan can help with this as he has a better inside view on the module.

Regards,
Bogdan

Mauro Davi' wrote:

>
> Hi All,
>
> using the callcontrol module I see that if the opensips server goes
> down, on the next start the BYE message aren’t sent to the call
> control module (i.e. the stop message).
>
> Attached there is the dialog module patch.
>
> I modified the |register_dlgcb (dialog, type, cb, param,
> free_param_cb)| function in this way:
>
> If the dialog parameter is null and the type isn’t equal to
> DIALOG_CREATED, the callback function is registered to all the active
> dialogs.
>
> So in the call control module, in the mod_init function I simply added
> this new lines:
>
> if (dlg_api.register_dlgcb(NULL, DLGCB_RESPONSE_FWDED,
> __dialog_replies, NULL, NULL) != 0) {
>
> LM_CRIT("cannot register callback for dialog confirmation\n");
>
> return -1;
>
> }
>
> if (dlg_api.register_dlgcb(NULL, DLGCB_TERMINATED | DLGCB_FAILED |
> DLGCB_EXPIRED | DLGCB_DESTROY, __dialog_ended, (void*)CCActive, NULL)
> != 0) {
>
> LM_CRIT("cannot register callback for dialog termination\n");
>
> return -1;
>
> }
>
> Now the BYE messages are sent to the call control module (stop
> messages) also if the opensips server is previously killed.
>
> I don’t know if this is the best solution, but it is a solution J
>
> Regards,
>
> MD
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Devel mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>  


_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: call_control, dialog and BYE messages patch

Dan Pascu
On Tuesday 31 March 2009, Bogdan-Andrei Iancu wrote:

> Hi Mauro,
>
> I think a better approach is to use the DLGCB_LOADED callback type.
> This is called when a dialog is restored from DB (at startup) and it is
> called per dialog. So the "callcontrol" module could register such
> callback and use it to register further whatever other callbacks are
> needed.
>
> Maybe Dan can help with this as he has a better inside view on the
> module.

Indeed. However the issue was (I'm not sure if it's still valid) that one
could not store particular information alongside the dialog in the
database. As a consequence, I do not know at the time the dialogs are
loaded from the database, to which of them I need to attach callbacks.

>
> Regards,
> Bogdan
>
> Mauro Davi' wrote:
> > Hi All,
> >
> > using the callcontrol module I see that if the opensips server goes
> > down, on the next start the BYE message aren’t sent to the call
> > control module (i.e. the stop message).
> >
> > Attached there is the dialog module patch.
> >
> > I modified the |register_dlgcb (dialog, type, cb, param,
> > free_param_cb)| function in this way:
> >
> > If the dialog parameter is null and the type isn’t equal to
> > DIALOG_CREATED, the callback function is registered to all the active
> > dialogs.
> >
> > So in the call control module, in the mod_init function I simply
> > added this new lines:
> >
> > if (dlg_api.register_dlgcb(NULL, DLGCB_RESPONSE_FWDED,
> > __dialog_replies, NULL, NULL) != 0) {
> >
> > LM_CRIT("cannot register callback for dialog confirmation\n");
> >
> > return -1;
> >
> > }
> >
> > if (dlg_api.register_dlgcb(NULL, DLGCB_TERMINATED | DLGCB_FAILED |
> > DLGCB_EXPIRED | DLGCB_DESTROY, __dialog_ended, (void*)CCActive, NULL)
> > != 0) {
> >
> > LM_CRIT("cannot register callback for dialog termination\n");
> >
> > return -1;
> >
> > }
> >
> > Now the BYE messages are sent to the call control module (stop
> > messages) also if the opensips server is previously killed.
> >
> > I don’t know if this is the best solution, but it is a solution J
> >
> > Regards,
> >
> > MD
> >
> > ---------------------------------------------------------------------
> >---
> >
> > _______________________________________________
> > Devel mailing list
> > [hidden email]
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/devel



--
Dan

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: call_control, dialog and BYE messages patch

Bogdan-Andrei Iancu
Hi Dan,

Dan Pascu wrote:

> On Tuesday 31 March 2009, Bogdan-Andrei Iancu wrote:
>  
>> Hi Mauro,
>>
>> I think a better approach is to use the DLGCB_LOADED callback type.
>> This is called when a dialog is restored from DB (at startup) and it is
>> called per dialog. So the "callcontrol" module could register such
>> callback and use it to register further whatever other callbacks are
>> needed.
>>
>> Maybe Dan can help with this as he has a better inside view on the
>> module.
>>    
>
> Indeed. However the issue was (I'm not sure if it's still valid) that one
> could not store particular information alongside the dialog in the
> database. As a consequence, I do not know at the time the dialogs are
> loaded from the database, to which of them I need to attach callbacks.
>  

right - this opens the discussion for another topic - a general way
(kind of string of properties) to save all the various props of the
dialog (profiles, dialog flags, dialog values, callbacks, etc). This to
be saved only at shutdown time...

Regards,
Bogdan

>  
>> Regards,
>> Bogdan
>>
>> Mauro Davi' wrote:
>>    
>>> Hi All,
>>>
>>> using the callcontrol module I see that if the opensips server goes
>>> down, on the next start the BYE message aren’t sent to the call
>>> control module (i.e. the stop message).
>>>
>>> Attached there is the dialog module patch.
>>>
>>> I modified the |register_dlgcb (dialog, type, cb, param,
>>> free_param_cb)| function in this way:
>>>
>>> If the dialog parameter is null and the type isn’t equal to
>>> DIALOG_CREATED, the callback function is registered to all the active
>>> dialogs.
>>>
>>> So in the call control module, in the mod_init function I simply
>>> added this new lines:
>>>
>>> if (dlg_api.register_dlgcb(NULL, DLGCB_RESPONSE_FWDED,
>>> __dialog_replies, NULL, NULL) != 0) {
>>>
>>> LM_CRIT("cannot register callback for dialog confirmation\n");
>>>
>>> return -1;
>>>
>>> }
>>>
>>> if (dlg_api.register_dlgcb(NULL, DLGCB_TERMINATED | DLGCB_FAILED |
>>> DLGCB_EXPIRED | DLGCB_DESTROY, __dialog_ended, (void*)CCActive, NULL)
>>> != 0) {
>>>
>>> LM_CRIT("cannot register callback for dialog termination\n");
>>>
>>> return -1;
>>>
>>> }
>>>
>>> Now the BYE messages are sent to the call control module (stop
>>> messages) also if the opensips server is previously killed.
>>>
>>> I don’t know if this is the best solution, but it is a solution J
>>>
>>> Regards,
>>>
>>> MD
>>>
>>> ---------------------------------------------------------------------
>>> ---
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> [hidden email]
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>>>      
>
>
>
>  


_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

R: call_control, dialog and BYE messages patch

Mauro Davì
Hi All,

attached the new call_control module patch using the DLBCB_LOADED callback type. Now it isn't necessary to modify the register_dlgcb  function in the dialog module

It works fine. The stop message of the current active dialog now arrives also after a server restart.

Regards,
    MD

-----Messaggio originale-----
Da: Bogdan-Andrei Iancu [mailto:[hidden email]]
Inviato: martedì 31 marzo 2009 12:01
A: Dan Pascu
Cc: Mauro Davi'; [hidden email]
Oggetto: Re: [OpenSIPS-Devel] call_control, dialog and BYE messages patch

Hi Dan,

Dan Pascu wrote:

> On Tuesday 31 March 2009, Bogdan-Andrei Iancu wrote:
>  
>> Hi Mauro,
>>
>> I think a better approach is to use the DLGCB_LOADED callback type.
>> This is called when a dialog is restored from DB (at startup) and it is
>> called per dialog. So the "callcontrol" module could register such
>> callback and use it to register further whatever other callbacks are
>> needed.
>>
>> Maybe Dan can help with this as he has a better inside view on the
>> module.
>>    
>
> Indeed. However the issue was (I'm not sure if it's still valid) that one
> could not store particular information alongside the dialog in the
> database. As a consequence, I do not know at the time the dialogs are
> loaded from the database, to which of them I need to attach callbacks.
>  
right - this opens the discussion for another topic - a general way
(kind of string of properties) to save all the various props of the
dialog (profiles, dialog flags, dialog values, callbacks, etc). This to
be saved only at shutdown time...

Regards,
Bogdan

>  
>> Regards,
>> Bogdan
>>
>> Mauro Davi' wrote:
>>    
>>> Hi All,
>>>
>>> using the callcontrol module I see that if the opensips server goes
>>> down, on the next start the BYE message aren't sent to the call
>>> control module (i.e. the stop message).
>>>
>>> Attached there is the dialog module patch.
>>>
>>> I modified the |register_dlgcb (dialog, type, cb, param,
>>> free_param_cb)| function in this way:
>>>
>>> If the dialog parameter is null and the type isn't equal to
>>> DIALOG_CREATED, the callback function is registered to all the active
>>> dialogs.
>>>
>>> So in the call control module, in the mod_init function I simply
>>> added this new lines:
>>>
>>> if (dlg_api.register_dlgcb(NULL, DLGCB_RESPONSE_FWDED,
>>> __dialog_replies, NULL, NULL) != 0) {
>>>
>>> LM_CRIT("cannot register callback for dialog confirmation\n");
>>>
>>> return -1;
>>>
>>> }
>>>
>>> if (dlg_api.register_dlgcb(NULL, DLGCB_TERMINATED | DLGCB_FAILED |
>>> DLGCB_EXPIRED | DLGCB_DESTROY, __dialog_ended, (void*)CCActive, NULL)
>>> != 0) {
>>>
>>> LM_CRIT("cannot register callback for dialog termination\n");
>>>
>>> return -1;
>>>
>>> }
>>>
>>> Now the BYE messages are sent to the call control module (stop
>>> messages) also if the opensips server is previously killed.
>>>
>>> I don't know if this is the best solution, but it is a solution J
>>>
>>> Regards,
>>>
>>> MD
>>>
>>> ---------------------------------------------------------------------
>>> ---
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> [hidden email]
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>>>      
>
>
>
>  

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

patch.tgz (892 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

R: R: call_control, dialog and BYE messages patch

Mauro Davì
Hi All,

a brief point of view. It's true, how Dan said, that the call_control module don't have all the information to know at the time that the dialogs are
loaded from the database, to which of them it needs to attach the callbacks.

But it is also true, that if I attach the callback to all the dialog, when the call_control module will receive a stop message, it simply can discard it responding with a "NOT FOUND" message from the rating engine.

I know that with a lot of call, not handled by the call control module, this isn't the best way but I think that, for me, is better to have the stop message on the call control module.

Regards,
        MD

-----Messaggio originale-----
Da: [hidden email] [mailto:[hidden email]] Per conto di Mauro Davi'
Inviato: giovedì 2 aprile 2009 11:04
A: Bogdan-Andrei Iancu; Dan Pascu
Cc: [hidden email]
Oggetto: [OpenSIPS-Devel] R: call_control, dialog and BYE messages patch

Hi All,

attached the new call_control module patch using the DLBCB_LOADED callback type. Now it isn't necessary to modify the register_dlgcb  function in the dialog module

It works fine. The stop message of the current active dialog now arrives also after a server restart.

Regards,
    MD

-----Messaggio originale-----
Da: Bogdan-Andrei Iancu [mailto:[hidden email]]
Inviato: martedì 31 marzo 2009 12:01
A: Dan Pascu
Cc: Mauro Davi'; [hidden email]
Oggetto: Re: [OpenSIPS-Devel] call_control, dialog and BYE messages patch

Hi Dan,

Dan Pascu wrote:

> On Tuesday 31 March 2009, Bogdan-Andrei Iancu wrote:
>  
>> Hi Mauro,
>>
>> I think a better approach is to use the DLGCB_LOADED callback type.
>> This is called when a dialog is restored from DB (at startup) and it is
>> called per dialog. So the "callcontrol" module could register such
>> callback and use it to register further whatever other callbacks are
>> needed.
>>
>> Maybe Dan can help with this as he has a better inside view on the
>> module.
>>    
>
> Indeed. However the issue was (I'm not sure if it's still valid) that one
> could not store particular information alongside the dialog in the
> database. As a consequence, I do not know at the time the dialogs are
> loaded from the database, to which of them I need to attach callbacks.
>  

right - this opens the discussion for another topic - a general way
(kind of string of properties) to save all the various props of the
dialog (profiles, dialog flags, dialog values, callbacks, etc). This to
be saved only at shutdown time...

Regards,
Bogdan

>  
>> Regards,
>> Bogdan
>>
>> Mauro Davi' wrote:
>>    
>>> Hi All,
>>>
>>> using the callcontrol module I see that if the opensips server goes
>>> down, on the next start the BYE message aren't sent to the call
>>> control module (i.e. the stop message).
>>>
>>> Attached there is the dialog module patch.
>>>
>>> I modified the |register_dlgcb (dialog, type, cb, param,
>>> free_param_cb)| function in this way:
>>>
>>> If the dialog parameter is null and the type isn't equal to
>>> DIALOG_CREATED, the callback function is registered to all the active
>>> dialogs.
>>>
>>> So in the call control module, in the mod_init function I simply
>>> added this new lines:
>>>
>>> if (dlg_api.register_dlgcb(NULL, DLGCB_RESPONSE_FWDED,
>>> __dialog_replies, NULL, NULL) != 0) {
>>>
>>> LM_CRIT("cannot register callback for dialog confirmation\n");
>>>
>>> return -1;
>>>
>>> }
>>>
>>> if (dlg_api.register_dlgcb(NULL, DLGCB_TERMINATED | DLGCB_FAILED |
>>> DLGCB_EXPIRED | DLGCB_DESTROY, __dialog_ended, (void*)CCActive, NULL)
>>> != 0) {
>>>
>>> LM_CRIT("cannot register callback for dialog termination\n");
>>>
>>> return -1;
>>>
>>> }
>>>
>>> Now the BYE messages are sent to the call control module (stop
>>> messages) also if the opensips server is previously killed.
>>>
>>> I don't know if this is the best solution, but it is a solution J
>>>
>>> Regards,
>>>
>>> MD
>>>
>>> ---------------------------------------------------------------------
>>> ---
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> [hidden email]
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>>>      
>
>
>
>  


_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: R: R: call_control, dialog and BYE messages patch

Dan Pascu
On Thursday 02 April 2009, Mauro Davi' wrote:

> Hi All,
>
> a brief point of view. It's true, how Dan said, that the call_control
> module don't have all the information to know at the time that the
> dialogs are loaded from the database, to which of them it needs to
> attach the callbacks.
>
> But it is also true, that if I attach the callback to all the dialog,
> when the call_control module will receive a stop message, it simply can
> discard it responding with a "NOT FOUND" message from the rating
> engine.

It won't go that far. The external callcontrol application will reply
directly as it doesn't have the session.

> I know that with a lot of call, not handled by the call control module,
> this isn't the best way but I think that, for me, is better to have the
> stop message on the call control module.

It's not that bad as one may think. This only happens after a restart,
until all the dialogs present on restart are ended. After that it enters
in the normal mode of operation. Unless you restart a lot and have a lot
of dialogs active during those moments (which is unlikely as I don't
expect people to restart servers during peak loads), it won't overload it
too much. Also considering that normally you go to the external call
control application for every INVITE, be it limited or not, but when the
dialog ends only for those under call control, it doesn't seem that much
to call the external application for every ended dialog after a restart
and do this only for the dialogs present during a restart. So I guess
it's a perfectly acceptable compromise until the dialog can store
additional information from modules.

Thanks, for the patch. I'll look into applying it. I guess we can do this
for mediaproxy as well.

--
Dan

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: R: R: call_control, dialog and BYE messages patch

Dan Pascu
On Thursday 02 April 2009, Dan Pascu wrote:
> Thanks, for the patch. I'll look into applying it.

It was applied to trunk and 1.5

> I guess we can do this for mediaproxy as well.

Unfortunately mediaproxy cannot benefit from this. It needs to know
exactly to what dialogs to attach to, otherwise it can produce more
problems than it solves.

--
Dan

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel