Re: receiving INFO request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gerard,

 

The on_tsx_state function must not be set in the mod_simpleua structure but in the inv_cb structure (look at lines 326-330 in simple_ua.c):

 

/* Init the callback for INVITE session: */

        pj_bzero(&inv_cb, sizeof(inv_cb));

        inv_cb._on_state_changed_ = &call_on_state_changed;

        inv_cb._on_new_session_ = &call_on_forked;

        inv_cb._on_media_update_ = &call_on_media_update;

        inv_cb._on_tsx_state_changed_ = &call_on_tsx_state_changed;

 

And here is an extract of my code:

 

/* Callback to be called when dialog state has changed.

* This callback intercepts the SIP_INFO messages

*/

 

static void call_on_tsx_state_changed(pjsip_inv_session *inv,

                                      pjsip_transaction *tsx,

                                      pjsip_event *e)

{

...

/* SIP INFO */

        if ((e->body.tsx_state.type == PJSIP_EVENT_RX_MSG) &&

            (tsx->state == PJSIP_TSX_STATE_TRYING) &&

            (strncmp(tsx->method.name.ptr, "INFO", 4) == 0)) {

                rdata = e->body.tsx_state.src.rdata;

...

 

Regards

Bernard

 

De : pjsip [mailto:pjsip-bounces@xxxxxxxxxxxxxxx] De la part de Gerard van den Bosch
Envoyé : vendredi 1 juillet 2016 10:49
À : pjsip list
Objet : Re: [pjsip] receiving INFO request

 

Hi Bernard,

 

The INFO message is inside the dialog and I can see it in the PJSIP debug.

But it does not get into my tsx state changed function.

 

I have defined the module as following:

static pjsip_module mod_simpleua =

{

    NULL, NULL, /* prev, next. */

    { "mod-simpleua", 12 }, /* Name. */

    -1, /* Id */

    PJSIP_MOD_PRIORITY_APPLICATION, /* Priority */

    NULL, /* load() */

    NULL, /* start() */

    NULL, /* stop() */

    NULL, /* unload() */

    &on_rx_request, /* on_rx_request() */

    NULL, /* on_rx_response() */

    NULL, /* on_tx_request. */

    NULL, /* on_tx_response() */

    &on_tsx_state, /* on_tsx_state() */

 

};

 

Register the module as following:

 status = pjsip_endpt_register_module( sip_endpt, &mod_simpleua);

 

And in the handler I try to do a printf:

static void on_tsx_state(pjsip_transaction *tsx, pjsip_event *event)

{

    const pjsip_method info_method =

    {

        PJSIP_OTHER_METHOD,

        { "INFO", 4 }

    };

 

    printf("-------------------Handle tsx state change!-------------------\n");

}

 

But the debug message is never printed at all.

 

And then I see in the PJSIP debug that it is unhandled.

 

Cheers,

Gerard

 

 

 

 

 

On Fri, Jul 1, 2016 at 3:55 PM, POQUILLON, Bernard <bpoquillon@xxxxxxxxxxxx> wrote:

Hi Gerard,

 

You can receive INFO message inside an established call or outside. Inside a call, you will be notified through the callback function inv_cb.on_tsx_state_changed. If you receive an INFO outside a dialog, then the on_rx_request function is called.

 

Hope it helps.

Bernard

 

De : pjsip [mailto:pjsip-bounces@xxxxxxxxxxxxxxx] De la part de Gerard van den Bosch
Envoyé : vendredi 1 juillet 2016 05:39
À : pjsip@xxxxxxxxxxxxxxx
Objet : [pjsip] receiving INFO request

 

Hello,

 

I am trying to extend the Simple UA example to accept INFO requests.

 

I have added on_tsx_state function to mod_simpleua with following prototype:

static void call_on_state_changed( pjsip_inv_session *inv,pjsip_event *e);

 

Then I added accept INFO capabilities to the end point.

const pj_str_t   STR_INFO = { "INFO",4 };

pjsip_endpt_add_capability(sip_endpt, NULL, PJSIP_H_ALLOW,NULL, 1, &STR_INFO);

 

But when the INFO messages comes in, in the debug I see the following:

 

11:12:17.823    tsx0x7389c8  ..Request msg INFO/cseq=7 (rdata0x6ca648) was unhandled by dialog usages, sending 500 response

11:12:17.823      siptest.c  ....TX 330 bytes Response msg 500/INFO/cseq=7 (tdta0x730ba0) to UDP 192.168.100.136:5060:

SIP/2.0 500 Unhandled by dialog usages

 

Am I missing something to receive the INFO messages properly?

 

Cheers,

Gerard

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

 

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux