NetComposer / nksip

Erlang SIP application server
Apache License 2.0
356 stars 126 forks source link

How to send BYE from callback function #35

Closed ates closed 9 years ago

ates commented 9 years ago

Hello,

Not an issue, just a question:

I use the following code to perform INVITE request:

nksip_uac:invite(Instance, To, [{callback, F}, {add, <<"Session-Expires">>, <<"1800;refresher=uac">>}, {body, nksip_sdp:new(<<"auto.nksip">>, Codecs)}])

Where F in callback option is

 F = fun
        ({resp, 180, Resp, _Call}) -> %% 180: Ringing
        %% Here I need send BYE request
 end,

I tried to use the following inside F function

{ok, Id} = nksip_response:meta(dialog_handle, Resp),
nksip_uac:bye(Id, []);

But got

error sending work {send_dialog,<<"1gnl6P">>,'BYE',[]}: looped_process

Should I extract the dialog_handle from _Call ? Or how to do that in correct way?

Thank you.

ates commented 9 years ago

Looks like found how to do that - need send BYE request outside callback function, e.g. through spawn.

One more question: do nksip really need have SASL application in dependencies?

kalta commented 9 years ago

Hi Artem

I just going to tell you exactly that. You can't send any request with the same Call-ID inside the callback function (since it is the same process). You must use a spawn. I'm not sure about sasl dependency. I don't remember using it for anything... you could try to remove it a see what happens.

Carlos

Carlos González Florido Responsable del Área de Innovación Subdirección de Tecnologías de la Información y Comunicaciones Dirección Estratégica de TIC del Sistema Sociosanitario Público de Andalucía Consejería de Igualdad, Salud y Políticas Sociales Parque Tecnológico de Andalucía C/ Marie Curie, 16 Edif. Possibilia 2005 - 1ª planta 29590 Campanillas (Málaga) T +34 951 015 300 | C 915300 F +34 951 015 301 | C 915301 Este correo electrónico y, en su caso, cualquier fichero anexo, contiene información confidencial exclusivamente dirigida a su(s) destinatario(s). This e-mail and any attachments are confidential and exclusively directed to its addressee(s). No imprimas este mensaje si no es necesario. El medio ambiente está en nuestras manos. Do not print this message if it is not necessary. The environment is in our hands.

On Mon, Nov 3, 2014 at 11:20 AM, Artem Teslenko notifications@github.com wrote:

Looks like found how to do that - need send BYE request outside callback function, e.g. through spawn.

One more question: do nksip realy need have SASL application in dependencies?

Reply to this email directly or view it on GitHub https://github.com/kalta/nksip/issues/35#issuecomment-61459320.

ates commented 9 years ago

Tried to remove SASL from nksip.app.src - nothing is broken, so I think it would be better to remove the SASL application.

Also found one more problem with the madtrick/wsock dependency, the application which use nksip can't be started from release. Here is a pull request: https://github.com/madtrick/wsock/pull/6, but no answer for a long time.