diff options
Diffstat (limited to 'pjsip-apps/src/samples/sipstateless.c')
-rw-r--r-- | pjsip-apps/src/samples/sipstateless.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/pjsip-apps/src/samples/sipstateless.c b/pjsip-apps/src/samples/sipstateless.c index d81c518f..d6bf01ec 100644 --- a/pjsip-apps/src/samples/sipstateless.c +++ b/pjsip-apps/src/samples/sipstateless.c @@ -20,10 +20,9 @@ /** * sipcore.c * - * This program is only used to measure the footprint of the SIP core. - * When UDP transport is included (with HAS_UDP_TRANSPORT macro), the - * executable will respond any incoming requests with 501 (Not Implemented) - * response statelessly. + * A simple program to respond any incoming requests (except ACK, of course!) + * with any status code (taken from command line argument, with the default + * is 501/Not Implemented). */ @@ -36,6 +35,8 @@ /* If this macro is set, UDP transport will be initialized at port 5060 */ #define HAS_UDP_TRANSPORT +/* If this macro is set, TCP transport will be initialized at port 5060 */ +#define HAS_TCP_TRANSPORT /* Log identification */ #define THIS_FILE "sipstateless.c" @@ -140,6 +141,26 @@ int main(int argc, char *argv[]) } #endif +#ifdef HAS_TCP_TRANSPORT + /* + * Add UDP transport, with hard-coded port + */ + { + pj_sockaddr_in addr; + + addr.sin_family = PJ_AF_INET; + addr.sin_addr.s_addr = 0; + addr.sin_port = pj_htons(5060); + + status = pjsip_tcp_transport_start(sip_endpt, &addr, 1, NULL); + if (status != PJ_SUCCESS) { + PJ_LOG(3,(THIS_FILE, + "Error starting TCP transport (port in use?)")); + return 1; + } + } +#endif + /* * Register our module to receive incoming requests. */ |