Architecture of pjsua-lib/pjsip/pjsip-lib described somewhere?

JS
Johan Sandgren
Thu, Mar 26, 2015 10:14 AM

Hi guys,

I'm trying to figure out how pjsua-lib works, ie connects with all modules and how all things are hooked together.
I'm new to the linux world, but need to understand to debug a problem I see with a special sip server.
I have looked at the documentation but haven't been able to figure it out how it all is connected and by what mechanisms.

For instance, I've built an application and connected on_pager on the application layer.
How can I understand how a message from the lowest level (udp-port incoming bytes - ok it's OS level) is received by some code, and sent further to who is supposed to be called back?

I understand there are modules for different purpose and they seem to have structures which are called into for different reasons (by whom?)

Example:

/* The module instance. /
static pjsip_module mod_pjsua_im =
{
NULL, NULL,                                                                                                                    /
prev, next.                              /
{ "mod-pjsua-im", 12 },                                    /
Name.                                      /
-1,                                                                                                                                        /
Id                                                                            /
PJSIP_MOD_PRIORITY_APPLICATION,      /
Priority                /
NULL,                                                                                                    /
load()                                        /
NULL,                                                                                                    /
start()                                        /
NULL,                                                                                                    /
stop()                                        /
NULL,                                                                                                    /
unload()                                  /
&im_on_rx_request,                                                                    /
on_rx_request()                  /
NULL,                                                                                                    /
on_rx_response()              /
NULL,                                                                                                    /
on_tx_request.                    /
NULL,                                                                                                    /
on_tx_response()              /
NULL,                                                                                                    /
on_tsx_state()                      */

};

Another example is from pjsip  - sip_transaction.c

/* Transaction layer module definition. */
static struct mod_tsx_layer
{
struct pjsip_module  mod;
pj_pool_t                                  *pool;
pjsip_endpoint                      *endpt;
pj_mutex_t                              *mutex;
pj_hash_table_t                    htable;
} mod_tsx_layer =
{  {
NULL, NULL,                                                              /
List's prev and next.    /
{ "mod-tsx-layer", 13 },            /
Module name.                                                      /
-1,                                                                                                              /
Module ID                                  /
PJSIP_MOD_PRIORITY_TSX_LAYER,              /
Priority.                                        /
mod_tsx_layer_load,                                            /
load().                                          /
mod_tsx_layer_start,                                          /
start()                                            /
mod_tsx_layer_stop,                                          /
stop()                                            /
mod_tsx_layer_unload,                                      /
unload()                                      /
mod_tsx_layer_on_rx_request,                      /
on_rx_request()                      /
mod_tsx_layer_on_rx_response,                  /
on_rx_response()                  */
NULL
}
};

Transaction layger is also module which has different entrypoints for different reasons (load,start,stop,unload), and callbacks (on_rx_request/response).
Who calls them? Where can I look to see how the library all connects together with all modules?

Would be very happy to get some pointers here, or links so I can GET how all this is connected, and see in source files or headers or other files how it is done.

Greetings,
Johan Sandgren


Johan Sandgren  (Software Engineer)
Svep Design Center AB
Box 1233, 221 05 Lund, Sweden
E-mail  johan.sandgren@svep.semailto:johan.sandgren@svep.se
Website www.svep.sehttp://www.svep.se/
Subscribe to our newsletterhttp://eepurl.com/_P72P

Hi guys, I'm trying to figure out how pjsua-lib works, ie connects with all modules and how all things are hooked together. I'm new to the linux world, but need to understand to debug a problem I see with a special sip server. I have looked at the documentation but haven't been able to figure it out how it all is connected and by what mechanisms. For instance, I've built an application and connected on_pager on the application layer. How can I understand how a message from the lowest level (udp-port incoming bytes - ok it's OS level) is received by some code, and sent further to who is supposed to be called back? I understand there are modules for different purpose and they seem to have structures which are called into for different reasons (by whom?) Example: /* The module instance. */ static pjsip_module mod_pjsua_im = { NULL, NULL, /* prev, next. */ { "mod-pjsua-im", 12 }, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_APPLICATION, /* Priority */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ NULL, /* unload() */ &im_on_rx_request, /* on_rx_request() */ NULL, /* on_rx_response() */ NULL, /* on_tx_request. */ NULL, /* on_tx_response() */ NULL, /* on_tsx_state() */ }; Another example is from pjsip - sip_transaction.c /* Transaction layer module definition. */ static struct mod_tsx_layer { struct pjsip_module mod; pj_pool_t *pool; pjsip_endpoint *endpt; pj_mutex_t *mutex; pj_hash_table_t *htable; } mod_tsx_layer = { { NULL, NULL, /* List's prev and next. */ { "mod-tsx-layer", 13 }, /* Module name. */ -1, /* Module ID */ PJSIP_MOD_PRIORITY_TSX_LAYER, /* Priority. */ mod_tsx_layer_load, /* load(). */ mod_tsx_layer_start, /* start() */ mod_tsx_layer_stop, /* stop() */ mod_tsx_layer_unload, /* unload() */ mod_tsx_layer_on_rx_request, /* on_rx_request() */ mod_tsx_layer_on_rx_response, /* on_rx_response() */ NULL } }; Transaction layger is also module which has different entrypoints for different reasons (load,start,stop,unload), and callbacks (on_rx_request/response). Who calls them? Where can I look to see how the library all connects together with all modules? Would be very happy to get some pointers here, or links so I can GET how all this is connected, and see in source files or headers or other files how it is done. Greetings, Johan Sandgren _______________ Johan Sandgren (Software Engineer) Svep Design Center AB Box 1233, 221 05 Lund, Sweden E-mail johan.sandgren@svep.se<mailto:johan.sandgren@svep.se> Website www.svep.se<http://www.svep.se/> Subscribe to our newsletter<http://eepurl.com/_P72P>
PB
POQUILLON, Bernard
Thu, Mar 26, 2015 10:42 AM

Hi Johan,

Don’t hesitate to have a look at http://trac.pjsip.org/repos/wiki/ In particular, read the PJSIP Developer’s Guide. It is quite old but explains the global architecture and the different levels (Transaction, Invite…).

Have a good day
Bernard

De : pjsip [mailto:pjsip-bounces@lists.pjsip.org] De la part de Johan Sandgren
Envoyé : jeudi 26 mars 2015 11:15
À : pjsip@lists.pjsip.org
Objet : [pjsip] Architecture of pjsua-lib/pjsip/pjsip-lib described somewhere?

Hi guys,

I’m trying to figure out how pjsua-lib works, ie connects with all modules and how all things are hooked together.
I’m new to the linux world, but need to understand to debug a problem I see with a special sip server.
I have looked at the documentation but haven’t been able to figure it out how it all is connected and by what mechanisms.

For instance, I’ve built an application and connected on_pager on the application layer.
How can I understand how a message from the lowest level (udp-port incoming bytes – ok it’s OS level) is received by some code, and sent further to who is supposed to be called back?

I understand there are modules for different purpose and they seem to have structures which are called into for different reasons (by whom?)

Example:

/* The module instance. /
static pjsip_module mod_pjsua_im =
{
NULL, NULL,                                                                                                                    /
prev, next.                              /
{ "mod-pjsua-im", 12 },                                    /
Name.                                      /
-1,                                                                                                                                        /
Id                                                                            /
PJSIP_MOD_PRIORITY_APPLICATION,      /
Priority                /
NULL,                                                                                                    /
load()                                        /
NULL,                                                                                                    /
start()                                        /
NULL,                                                                                                    /
stop()                                        /
NULL,                                                                                                    /
unload()                                  /
&im_on_rx_request,                                                                    /
on_rx_request()                  /
NULL,                                                                                                    /
on_rx_response()              /
NULL,                                                                                                    /
on_tx_request.                    /
NULL,                                                                                                    /
on_tx_response()              /
NULL,                                                                                                    /
on_tsx_state()                      */

};

Another example is from pjsip  - sip_transaction.c

/* Transaction layer module definition. */
static struct mod_tsx_layer
{
struct pjsip_module  mod;
pj_pool_t                                  *pool;
pjsip_endpoint                      *endpt;
pj_mutex_t                              *mutex;
pj_hash_table_t                    htable;
} mod_tsx_layer =
{  {
NULL, NULL,                                                              /
List's prev and next.    /
{ "mod-tsx-layer", 13 },            /
Module name.                                                      /
-1,                                                                                                              /
Module ID                                  /
PJSIP_MOD_PRIORITY_TSX_LAYER,              /
Priority.                                        /
mod_tsx_layer_load,                                            /
load().                                          /
mod_tsx_layer_start,                                          /
start()                                            /
mod_tsx_layer_stop,                                          /
stop()                                            /
mod_tsx_layer_unload,                                      /
unload()                                      /
mod_tsx_layer_on_rx_request,                      /
on_rx_request()                      /
mod_tsx_layer_on_rx_response,                  /
on_rx_response()                  */
NULL
}
};

Transaction layger is also module which has different entrypoints for different reasons (load,start,stop,unload), and callbacks (on_rx_request/response).
Who calls them? Where can I look to see how the library all connects together with all modules?

Would be very happy to get some pointers here, or links so I can GET how all this is connected, and see in source files or headers or other files how it is done.

Greetings,
Johan Sandgren


Johan Sandgren  (Software Engineer)
Svep Design Center AB
Box 1233, 221 05 Lund, Sweden
E-mail  johan.sandgren@svep.semailto:johan.sandgren@svep.se
Website www.svep.sehttp://www.svep.se/
Subscribe to our newsletterhttp://eepurl.com/_P72P

Hi Johan, Don’t hesitate to have a look at http://trac.pjsip.org/repos/wiki/ In particular, read the PJSIP Developer’s Guide. It is quite old but explains the global architecture and the different levels (Transaction, Invite…). Have a good day Bernard De : pjsip [mailto:pjsip-bounces@lists.pjsip.org] De la part de Johan Sandgren Envoyé : jeudi 26 mars 2015 11:15 À : pjsip@lists.pjsip.org Objet : [pjsip] Architecture of pjsua-lib/pjsip/pjsip-lib described somewhere? Hi guys, I’m trying to figure out how pjsua-lib works, ie connects with all modules and how all things are hooked together. I’m new to the linux world, but need to understand to debug a problem I see with a special sip server. I have looked at the documentation but haven’t been able to figure it out how it all is connected and by what mechanisms. For instance, I’ve built an application and connected on_pager on the application layer. How can I understand how a message from the lowest level (udp-port incoming bytes – ok it’s OS level) is received by some code, and sent further to who is supposed to be called back? I understand there are modules for different purpose and they seem to have structures which are called into for different reasons (by whom?) Example: /* The module instance. */ static pjsip_module mod_pjsua_im = { NULL, NULL, /* prev, next. */ { "mod-pjsua-im", 12 }, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_APPLICATION, /* Priority */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ NULL, /* unload() */ &im_on_rx_request, /* on_rx_request() */ NULL, /* on_rx_response() */ NULL, /* on_tx_request. */ NULL, /* on_tx_response() */ NULL, /* on_tsx_state() */ }; Another example is from pjsip - sip_transaction.c /* Transaction layer module definition. */ static struct mod_tsx_layer { struct pjsip_module mod; pj_pool_t *pool; pjsip_endpoint *endpt; pj_mutex_t *mutex; pj_hash_table_t *htable; } mod_tsx_layer = { { NULL, NULL, /* List's prev and next. */ { "mod-tsx-layer", 13 }, /* Module name. */ -1, /* Module ID */ PJSIP_MOD_PRIORITY_TSX_LAYER, /* Priority. */ mod_tsx_layer_load, /* load(). */ mod_tsx_layer_start, /* start() */ mod_tsx_layer_stop, /* stop() */ mod_tsx_layer_unload, /* unload() */ mod_tsx_layer_on_rx_request, /* on_rx_request() */ mod_tsx_layer_on_rx_response, /* on_rx_response() */ NULL } }; Transaction layger is also module which has different entrypoints for different reasons (load,start,stop,unload), and callbacks (on_rx_request/response). Who calls them? Where can I look to see how the library all connects together with all modules? Would be very happy to get some pointers here, or links so I can GET how all this is connected, and see in source files or headers or other files how it is done. Greetings, Johan Sandgren _______________ Johan Sandgren (Software Engineer) Svep Design Center AB Box 1233, 221 05 Lund, Sweden E-mail johan.sandgren@svep.se<mailto:johan.sandgren@svep.se> Website www.svep.se<http://www.svep.se/> Subscribe to our newsletter<http://eepurl.com/_P72P>
JS
Johan Sandgren
Thu, Mar 26, 2015 12:14 PM

Perfect tip Bernard, thank you SO MUCH!
Time to dig in ☺

/Johan

Från: pjsip [mailto:pjsip-bounces@lists.pjsip.org] För POQUILLON, Bernard
Skickat: den 26 mars 2015 11:43
Till: pjsip list
Ämne: Re: [pjsip] Architecture of pjsua-lib/pjsip/pjsip-lib described somewhere?

Hi Johan,

Don’t hesitate to have a look at http://trac.pjsip.org/repos/wiki/ In particular, read the PJSIP Developer’s Guide. It is quite old but explains the global architecture and the different levels (Transaction, Invite…).

Have a good day
Bernard

De : pjsip [mailto:pjsip-bounces@lists.pjsip.org] De la part de Johan Sandgren
Envoyé : jeudi 26 mars 2015 11:15
À : pjsip@lists.pjsip.orgmailto:pjsip@lists.pjsip.org
Objet : [pjsip] Architecture of pjsua-lib/pjsip/pjsip-lib described somewhere?

Hi guys,

I’m trying to figure out how pjsua-lib works, ie connects with all modules and how all things are hooked together.
I’m new to the linux world, but need to understand to debug a problem I see with a special sip server.
I have looked at the documentation but haven’t been able to figure it out how it all is connected and by what mechanisms.

For instance, I’ve built an application and connected on_pager on the application layer.
How can I understand how a message from the lowest level (udp-port incoming bytes – ok it’s OS level) is received by some code, and sent further to who is supposed to be called back?

I understand there are modules for different purpose and they seem to have structures which are called into for different reasons (by whom?)

Example:

/* The module instance. /
static pjsip_module mod_pjsua_im =
{
NULL, NULL,                                                                                                                    /
prev, next.                              /
{ "mod-pjsua-im", 12 },                                    /
Name.                                      /
-1,                                                                                                                                        /
Id                                                                            /
PJSIP_MOD_PRIORITY_APPLICATION,      /
Priority                /
NULL,                                                                                                    /
load()                                        /
NULL,                                                                                                    /
start()                                        /
NULL,                                                                                                    /
stop()                                        /
NULL,                                                                                                    /
unload()                                  /
&im_on_rx_request,                                                                    /
on_rx_request()                  /
NULL,                                                                                                    /
on_rx_response()              /
NULL,                                                                                                    /
on_tx_request.                    /
NULL,                                                                                                    /
on_tx_response()              /
NULL,                                                                                                    /
on_tsx_state()                      */

};

Another example is from pjsip  - sip_transaction.c

/* Transaction layer module definition. */
static struct mod_tsx_layer
{
struct pjsip_module  mod;
pj_pool_t                                  *pool;
pjsip_endpoint                      *endpt;
pj_mutex_t                              *mutex;
pj_hash_table_t                    htable;
} mod_tsx_layer =
{  {
NULL, NULL,                                                              /
List's prev and next.    /
{ "mod-tsx-layer", 13 },            /
Module name.                                                      /
-1,                                                                                                              /
Module ID                                  /
PJSIP_MOD_PRIORITY_TSX_LAYER,              /
Priority.                                        /
mod_tsx_layer_load,                                            /
load().                                          /
mod_tsx_layer_start,                                          /
start()                                            /
mod_tsx_layer_stop,                                          /
stop()                                            /
mod_tsx_layer_unload,                                      /
unload()                                      /
mod_tsx_layer_on_rx_request,                      /
on_rx_request()                      /
mod_tsx_layer_on_rx_response,                  /
on_rx_response()                  */
NULL
}
};

Transaction layger is also module which has different entrypoints for different reasons (load,start,stop,unload), and callbacks (on_rx_request/response).
Who calls them? Where can I look to see how the library all connects together with all modules?

Would be very happy to get some pointers here, or links so I can GET how all this is connected, and see in source files or headers or other files how it is done.

Greetings,
Johan Sandgren


Johan Sandgren  (Software Engineer)
Svep Design Center AB
Box 1233, 221 05 Lund, Sweden
E-mail  johan.sandgren@svep.semailto:johan.sandgren@svep.se
Website www.svep.sehttp://www.svep.se/
Subscribe to our newsletterhttp://eepurl.com/_P72P

Perfect tip Bernard, thank you SO MUCH! Time to dig in ☺ /Johan Från: pjsip [mailto:pjsip-bounces@lists.pjsip.org] För POQUILLON, Bernard Skickat: den 26 mars 2015 11:43 Till: pjsip list Ämne: Re: [pjsip] Architecture of pjsua-lib/pjsip/pjsip-lib described somewhere? Hi Johan, Don’t hesitate to have a look at http://trac.pjsip.org/repos/wiki/ In particular, read the PJSIP Developer’s Guide. It is quite old but explains the global architecture and the different levels (Transaction, Invite…). Have a good day Bernard De : pjsip [mailto:pjsip-bounces@lists.pjsip.org] De la part de Johan Sandgren Envoyé : jeudi 26 mars 2015 11:15 À : pjsip@lists.pjsip.org<mailto:pjsip@lists.pjsip.org> Objet : [pjsip] Architecture of pjsua-lib/pjsip/pjsip-lib described somewhere? Hi guys, I’m trying to figure out how pjsua-lib works, ie connects with all modules and how all things are hooked together. I’m new to the linux world, but need to understand to debug a problem I see with a special sip server. I have looked at the documentation but haven’t been able to figure it out how it all is connected and by what mechanisms. For instance, I’ve built an application and connected on_pager on the application layer. How can I understand how a message from the lowest level (udp-port incoming bytes – ok it’s OS level) is received by some code, and sent further to who is supposed to be called back? I understand there are modules for different purpose and they seem to have structures which are called into for different reasons (by whom?) Example: /* The module instance. */ static pjsip_module mod_pjsua_im = { NULL, NULL, /* prev, next. */ { "mod-pjsua-im", 12 }, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_APPLICATION, /* Priority */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ NULL, /* unload() */ &im_on_rx_request, /* on_rx_request() */ NULL, /* on_rx_response() */ NULL, /* on_tx_request. */ NULL, /* on_tx_response() */ NULL, /* on_tsx_state() */ }; Another example is from pjsip - sip_transaction.c /* Transaction layer module definition. */ static struct mod_tsx_layer { struct pjsip_module mod; pj_pool_t *pool; pjsip_endpoint *endpt; pj_mutex_t *mutex; pj_hash_table_t *htable; } mod_tsx_layer = { { NULL, NULL, /* List's prev and next. */ { "mod-tsx-layer", 13 }, /* Module name. */ -1, /* Module ID */ PJSIP_MOD_PRIORITY_TSX_LAYER, /* Priority. */ mod_tsx_layer_load, /* load(). */ mod_tsx_layer_start, /* start() */ mod_tsx_layer_stop, /* stop() */ mod_tsx_layer_unload, /* unload() */ mod_tsx_layer_on_rx_request, /* on_rx_request() */ mod_tsx_layer_on_rx_response, /* on_rx_response() */ NULL } }; Transaction layger is also module which has different entrypoints for different reasons (load,start,stop,unload), and callbacks (on_rx_request/response). Who calls them? Where can I look to see how the library all connects together with all modules? Would be very happy to get some pointers here, or links so I can GET how all this is connected, and see in source files or headers or other files how it is done. Greetings, Johan Sandgren _______________ Johan Sandgren (Software Engineer) Svep Design Center AB Box 1233, 221 05 Lund, Sweden E-mail johan.sandgren@svep.se<mailto:johan.sandgren@svep.se> Website www.svep.se<http://www.svep.se/> Subscribe to our newsletter<http://eepurl.com/_P72P>