Module: sip-router Branch: master Commit: 7dfe7c223f779b039e86ef0b5ab0c8cc1785613a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7dfe7c22...
Author: Carsten Bock carsten@bock.info Committer: Carsten Bock carsten@bock.info Date: Thu Feb 10 23:46:58 2011 +0100
- Updated patch and example config after testing.
---
modules/rtpproxy/test/kamailio.cfg | 10 +++--- modules/rtpproxy/test/rtpproxy.patch | 58 +++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/modules/rtpproxy/test/kamailio.cfg b/modules/rtpproxy/test/kamailio.cfg index 5c36c3b..0d5c73f 100644 --- a/modules/rtpproxy/test/kamailio.cfg +++ b/modules/rtpproxy/test/kamailio.cfg @@ -28,7 +28,7 @@ auto_aliases=no tos=0x80
# ------------------ module loading ---------------------------------- -mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/" +mpath="sip-router/modules_k:sip-router/modules" # To Check/modufy the maximum forwards loadmodule "maxfwd.so" # Transaction-Module @@ -70,7 +70,7 @@ loadmodule "registrar.so" modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:22222") # Nathelper: RTP-Proxy Timeout modparam("rtpproxy", "rtpproxy_tout", 3) -modparam("rtpproxy", "timeout_socket", "http://localhost:8000/RPC2") +modparam("rtpproxy", "timeout_socket", "xmlrpc:http://localhost:8000/RPC2")
# ----------------- Settings for max-fwd --------------- # Max-Forward-Module: Set the maximum to 20 @@ -122,7 +122,7 @@ modparam("dialog", "db_mode", 0) # The number of dialogs to be fetched per loop #modparam("dialog", "db_fetch_rows", 120)
-modparam("registrar", "max_expires", 60); +modparam("registrar", "max_expires", 10); modparam("registrar", "received_avp", "$avp(i:100)"); modparam("nathelper", "received_avp", "$avp(i:100)");
@@ -197,7 +197,7 @@ route { ################################################################################################################## # Use RTP-Proxy ############################################################################################################### - if (!force_rtp_proxy("arf")) { + if (!rtpproxy_offer("arf")) { sl_send_reply("503", "No RTP-Relay available"); exit; } @@ -346,7 +346,7 @@ onreply_route[1] { fix_nated_contact(); # Content-Length prüfen if (!search("^Content-Length:[ ]*0")) { - force_rtp_proxy("arf"); + rtpproxy_answer("arf"); } } } diff --git a/modules/rtpproxy/test/rtpproxy.patch b/modules/rtpproxy/test/rtpproxy.patch index 3fc23b8..3d2e8b4 100644 --- a/modules/rtpproxy/test/rtpproxy.patch +++ b/modules/rtpproxy/test/rtpproxy.patch @@ -7589,7 +7589,7 @@ index 54c1a60..1c88b99 100644 +AC_SUBST(LIBS_XMLRPC) AC_OUTPUT diff --git a/rtpp_command.c b/rtpp_command.c -index c5734ae..1afae6a 100644 +index c5734ae..d6072de 100644 --- a/rtpp_command.c +++ b/rtpp_command.c @@ -69,6 +69,9 @@ struct proto_cap proto_caps[] = { @@ -7610,22 +7610,51 @@ index c5734ae..1afae6a 100644
requested_nsamples = -1; ia[0] = ia[1] = NULL; -@@ -965,17 +969,30 @@ handle_command(struct cfg *cf, int controlfd, double dtime) +@@ -468,7 +472,7 @@ handle_command(struct cfg *cf, int controlfd, double dtime) + } + call_id = argv[1]; + if (op == UPDATE || op == LOOKUP || op == PLAY) { +- max_argc = (op == UPDATE ? 8 : 6); ++ max_argc = (op == PLAY ? 6 : 8); + if (argc < 5 || argc > max_argc) { + rtpp_log_write(RTPP_LOG_ERR, cf->stable.glog, "command syntax error"); + reply_error(&cf->stable, controlfd, &raddr, rlen, cookie, 4); +@@ -478,7 +482,7 @@ handle_command(struct cfg *cf, int controlfd, double dtime) + to_tag = argv[5]; + if (op == PLAY && argv[0][1] != '\0') + playcount = atoi(argv[0] + 1); +- if (op == UPDATE && argc > 6) { ++ if (op != PLAY && argc > 6) { + socket_name_u = argv[6]; + if (strncmp("unix:", socket_name_u, 5) == 0) + socket_name_u += 5; +@@ -965,25 +969,39 @@ handle_command(struct cfg *cf, int controlfd, double dtime) }
pthread_mutex_lock(&cf->glock); -+ - if (op == UPDATE) { +- if (op == UPDATE) { - if (cf->timeout_handler->socket_name == NULL && socket_name_u != NULL) - rtpp_log_write(RTPP_LOG_ERR, spa->log, "must permit notification socket with -n"); ++ ++ if ((op == UPDATE) || (op == LOOKUP)){ if (spa->timeout_data.notify_tag != NULL) { free(spa->timeout_data.notify_tag); spa->timeout_data.notify_tag = NULL; } - if (cf->timeout_handler->socket_name != NULL && socket_name_u != NULL) { - if (strcmp(cf->timeout_handler->socket_name, socket_name_u) != 0) { +- if (cf->timeout_handler->socket_name != NULL && socket_name_u != NULL) { +- if (strcmp(cf->timeout_handler->socket_name, socket_name_u) != 0) { - rtpp_log_write(RTPP_LOG_ERR, spa->log, "invalid socket name %s", socket_name_u); - socket_name_u = NULL; +- } else { ++ spa->timeout_data.handler = NULL; ++ if (socket_name_u != NULL) { ++ if (cf->timeout_handler != NULL && cf->timeout_handler->socket_name != NULL ++ && strlen(cf->timeout_handler->socket_name) == strlen(socket_name_u) ++ && strcmp(cf->timeout_handler->socket_name, socket_name_u) != 0) { + rtpp_log_write(RTPP_LOG_INFO, spa->log, "setting timeout handler"); + spa->timeout_data.handler = cf->timeout_handler; + spa->timeout_data.notify_tag = strdup(notify_tag); ++ } else { + rtpp_log_write(RTPP_LOG_INFO, spa->log, "setting custom timeout handler (%s)", socket_name_u); + my_timeout_h = malloc(sizeof(struct rtpp_timeout_handler)); + if (my_timeout_h == NULL) { @@ -7636,15 +7665,20 @@ index c5734ae..1afae6a 100644 + if(my_timeout_h->socket_name != NULL) { + strcpy(my_timeout_h->socket_name, socket_name_u); + spa->timeout_data.handler = my_timeout_h; -+ spa->timeout_data.notify_tag = strdup(notify_tag); ++ if (notify_tag != NULL) spa->timeout_data.notify_tag = strdup(notify_tag); ++ else spa->timeout_data.notify_tag = NULL; + } else { + rtpp_log_write(RTPP_LOG_ERR, spa->log, "Unable to allocate memory"); + free(my_timeout_h); + } + } - } else { - rtpp_log_write(RTPP_LOG_INFO, spa->log, "setting timeout handler"); - spa->timeout_data.handler = cf->timeout_handler; + } +- } else if (socket_name_u == NULL && spa->timeout_data.handler != NULL) { +- spa->timeout_data.handler = NULL; +- rtpp_log_write(RTPP_LOG_INFO, spa->log, "disabling timeout handler"); + } + } + diff --git a/rtpp_notify.c b/rtpp_notify.c index e92c9ec..35982bf 100644 --- a/rtpp_notify.c @@ -7798,7 +7832,7 @@ index e92c9ec..35982bf 100644 wi->th->connected = 0; rtpp_log_ewrite(RTPP_LOG_ERR, wi->glog, "failed to send timeout notification"); diff --git a/rtpp_session.c b/rtpp_session.c -index 03e3d8a..78b2135 100644 +index 03e3d8a..44a34fa 100644 --- a/rtpp_session.c +++ b/rtpp_session.c @@ -41,6 +41,7 @@ @@ -7815,7 +7849,7 @@ index 03e3d8a..78b2135 100644 free(sp->timeout_data.notify_tag); +#ifdef ENABLE_XMLRPC + // In case we use a custom timeout handler, we have to free it. -+ if (sp->timeout_data.handler != &cf->timeout_handler) { ++ if (sp->timeout_data.handler && (sp->timeout_data.handler != &cf->timeout_handler)) { + free(sp->timeout_data.handler->socket_name); + free(sp->timeout_data.handler); + }