Module: sip-router Branch: pd/msrp Commit: 4a2ed1cc36e1f69695b0441f7b6c4df36be6235c URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4a2ed1cc...
Author: Peter Dunkley peter.dunkley@crocodile-rcs.com Committer: Peter Dunkley peter.dunkley@crocodile-rcs.com Date: Wed Feb 13 11:03:51 2013 +0000
modules/msrp: Made use of cmap mandatory as tmap and failure reports require it
---
modules/msrp/msrp_mod.c | 51 +++++++++++++++++++++++------------------------ 1 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/modules/msrp/msrp_mod.c b/modules/msrp/msrp_mod.c index c1a0b04..5162652 100644 --- a/modules/msrp/msrp_mod.c +++ b/modules/msrp/msrp_mod.c @@ -69,12 +69,12 @@ static int w_msrp_tmap_del(sip_msg_t* msg, char* str1, char* str2); static void msrp_local_timer(unsigned int ticks, void* param); /*!< Local timer handler */
int msrp_param_sipmsg = 1; -int msrp_cmap_size = 0; +int msrp_cmap_size = 8; int msrp_auth_min_expires = 60; int msrp_auth_max_expires = 3600; int msrp_timer_interval = 60; str msrp_use_path_addr = { 0 }; -int msrp_tmap_size = 10; +int msrp_tmap_size = 8;
static int msrp_frame_received(void *data); sip_msg_t *msrp_fake_sipmsg(msrp_frame_t *mf); @@ -169,30 +169,30 @@ static int mod_init(void) return -1; }
- if(msrp_cmap_size>0) { - if(msrp_cmap_size>16) - msrp_cmap_size = 16; - if(msrp_cmap_init(1<<msrp_cmap_size)<0) { - LM_ERR("Cannot init internal cmap\n"); - return -1; - } + if(msrp_tmap_init_rpc()<0) + { + LM_ERR("failed to register tmap RPC commands\n"); + return -1; }
- if(msrp_tmap_size>0) { - if(msrp_tmap_size>16) - msrp_tmap_size = 16; - if(msrp_tmap_init(1<<msrp_tmap_size)<0) { - LM_ERR("Cannot init tmap\n"); - return -1; - } + if(msrp_cmap_size<=0) msrp_cmap_size = 8; + else if(msrp_cmap_size>16) msrp_cmap_size = 16; + if(msrp_cmap_init(1<<msrp_cmap_size)<0) { + LM_ERR("Cannot init internal cmap\n"); + return -1; }
- if (msrp_cmap_size> 0 || msrp_tmap_size> 0) { - if(msrp_timer_interval<=0) - msrp_timer_interval = 60; - register_sync_timers(1); + if(msrp_tmap_size<=0) msrp_tmap_size = 8; + else if(msrp_tmap_size>16) msrp_tmap_size = 16; + if(msrp_tmap_init(1<<msrp_tmap_size)<0) { + LM_ERR("Cannot init tmap\n"); + return -1; }
+ if(msrp_timer_interval<=0) + msrp_timer_interval = 60; + register_sync_timers(1); + sr_event_register_cb(SREV_TCP_MSRP_FRAME, msrp_frame_received); return 0; } @@ -209,12 +209,11 @@ static int child_init(int rank)
if (rank!=PROC_MAIN) return 0; - if(msrp_cmap_size>0 || msrp_tmap_size>0) { - if(fork_sync_timer(PROC_TIMER, "MSRP Timer", 1 /*socks flag*/, - msrp_local_timer, NULL, msrp_timer_interval /*sec*/)<0) { - LM_ERR("failed to start timer routine as process\n"); - return -1; /* error */ - } + + if(fork_sync_timer(PROC_TIMER, "MSRP Timer", 1 /*socks flag*/, + msrp_local_timer, NULL, msrp_timer_interval /*sec*/)<0) { + LM_ERR("failed to start timer routine as process\n"); + return -1; /* error */ }
return 0;