|
@@ -190,6 +190,7 @@ MODULE_VERSION
|
|
static int fixup_hostport2proxy(void** param, int param_no);
|
|
static int fixup_hostport2proxy(void** param, int param_no);
|
|
static int fixup_proto_hostport2proxy(void** param, int param_no);
|
|
static int fixup_proto_hostport2proxy(void** param, int param_no);
|
|
static int fixup_on_failure(void** param, int param_no);
|
|
static int fixup_on_failure(void** param, int param_no);
|
|
|
|
+static int fixup_on_branch_failure(void** param, int param_no);
|
|
static int fixup_on_reply(void** param, int param_no);
|
|
static int fixup_on_reply(void** param, int param_no);
|
|
static int fixup_on_branch(void** param, int param_no);
|
|
static int fixup_on_branch(void** param, int param_no);
|
|
static int fixup_t_reply(void** param, int param_no);
|
|
static int fixup_t_reply(void** param, int param_no);
|
|
@@ -272,6 +273,7 @@ inline static int w_t_forward_nonack_sctp(struct sip_msg*, char* str,char*);
|
|
inline static int w_t_forward_nonack_to(struct sip_msg* msg, char* str,char*);
|
|
inline static int w_t_forward_nonack_to(struct sip_msg* msg, char* str,char*);
|
|
inline static int w_t_relay_cancel(struct sip_msg *p_msg, char *_foo, char *_bar);
|
|
inline static int w_t_relay_cancel(struct sip_msg *p_msg, char *_foo, char *_bar);
|
|
inline static int w_t_on_failure(struct sip_msg* msg, char *go_to, char *foo);
|
|
inline static int w_t_on_failure(struct sip_msg* msg, char *go_to, char *foo);
|
|
|
|
+inline static int w_t_on_branch_failure(struct sip_msg* msg, char *go_to, char *foo);
|
|
inline static int w_t_on_branch(struct sip_msg* msg, char *go_to, char *foo);
|
|
inline static int w_t_on_branch(struct sip_msg* msg, char *go_to, char *foo);
|
|
inline static int w_t_on_reply(struct sip_msg* msg, char *go_to, char *foo );
|
|
inline static int w_t_on_reply(struct sip_msg* msg, char *go_to, char *foo );
|
|
inline static int t_check_status(struct sip_msg* msg, char *match, char *foo);
|
|
inline static int t_check_status(struct sip_msg* msg, char *match, char *foo);
|
|
@@ -409,12 +411,14 @@ static cmd_export_t cmds[]={
|
|
REQUEST_ROUTE},
|
|
REQUEST_ROUTE},
|
|
{"t_on_failure", w_t_on_failure, 1, fixup_on_failure,
|
|
{"t_on_failure", w_t_on_failure, 1, fixup_on_failure,
|
|
REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE | BRANCH_ROUTE },
|
|
REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE | BRANCH_ROUTE },
|
|
|
|
+ {"t_on_branch_failure",w_t_on_branch_failure, 1, fixup_on_branch_failure,
|
|
|
|
+ REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE | BRANCH_ROUTE },
|
|
{"t_on_reply", w_t_on_reply, 1, fixup_on_reply,
|
|
{"t_on_reply", w_t_on_reply, 1, fixup_on_reply,
|
|
REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE | BRANCH_ROUTE },
|
|
REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE | BRANCH_ROUTE },
|
|
{"t_on_branch", w_t_on_branch, 1, fixup_on_branch,
|
|
{"t_on_branch", w_t_on_branch, 1, fixup_on_branch,
|
|
REQUEST_ROUTE | FAILURE_ROUTE },
|
|
REQUEST_ROUTE | FAILURE_ROUTE },
|
|
{"t_check_status", t_check_status, 1, fixup_t_check_status,
|
|
{"t_check_status", t_check_status, 1, fixup_t_check_status,
|
|
- REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | BRANCH_FAILURE_ROUTE},
|
|
|
|
|
|
+ REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE},
|
|
{"t_write_req", t_write_req, 2, fixup_t_write,
|
|
{"t_write_req", t_write_req, 2, fixup_t_write,
|
|
REQUEST_ROUTE | FAILURE_ROUTE },
|
|
REQUEST_ROUTE | FAILURE_ROUTE },
|
|
{"t_write_unix", t_write_unix, 2, fixup_t_write,
|
|
{"t_write_unix", t_write_unix, 2, fixup_t_write,
|
|
@@ -478,7 +482,7 @@ static cmd_export_t cmds[]={
|
|
{"t_next_contacts", t_next_contacts, 0, 0,
|
|
{"t_next_contacts", t_next_contacts, 0, 0,
|
|
REQUEST_ROUTE | FAILURE_ROUTE},
|
|
REQUEST_ROUTE | FAILURE_ROUTE},
|
|
{"t_next_contact_flow", t_next_contact_flow, 0, 0,
|
|
{"t_next_contact_flow", t_next_contact_flow, 0, 0,
|
|
- REQUEST_ROUTE | BRANCH_FAILURE_ROUTE},
|
|
|
|
|
|
+ REQUEST_ROUTE },
|
|
|
|
|
|
/* not applicable from the script */
|
|
/* not applicable from the script */
|
|
{"load_tm", (cmd_function)load_tm, NO_SCRIPT, 0, 0},
|
|
{"load_tm", (cmd_function)load_tm, NO_SCRIPT, 0, 0},
|
|
@@ -602,6 +606,32 @@ static int fixup_on_failure(void** param, int param_no)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#define BRANCH_FAILURE_ROUTE_PREFIX "tm:branch-failure"
|
|
|
|
+static int fixup_on_branch_failure(void** param, int param_no)
|
|
|
|
+{
|
|
|
|
+ char *full_route_name = NULL;
|
|
|
|
+ int len;
|
|
|
|
+ int ret = 0;
|
|
|
|
+ if (param_no==1){
|
|
|
|
+ if((len = strlen((char*)*param))<=1
|
|
|
|
+ && (*(char*)(*param)==0 || *(char*)(*param)=='0')) {
|
|
|
|
+ *param = (void*)0;
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ len += strlen(BRANCH_FAILURE_ROUTE_PREFIX) + 1;
|
|
|
|
+ if ((full_route_name = pkg_malloc(len+1)) == NULL)
|
|
|
|
+ {
|
|
|
|
+ LM_ERR("No memory left in branch_failure fixup\n");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ sprintf(full_route_name, "%s:%s", BRANCH_FAILURE_ROUTE_PREFIX, (char*)*param);
|
|
|
|
+ *param=(void*)full_route_name;
|
|
|
|
+ ret = fixup_routes("t_on_branch_failure", &event_rt, param);
|
|
|
|
+ pkg_free(full_route_name);
|
|
|
|
+ }
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
static int fixup_on_reply(void** param, int param_no)
|
|
static int fixup_on_reply(void** param, int param_no)
|
|
{
|
|
{
|
|
@@ -734,6 +764,7 @@ static int script_init( struct sip_msg *foo, unsigned int flags, void *bar)
|
|
message's t_on_failure value
|
|
message's t_on_failure value
|
|
*/
|
|
*/
|
|
t_on_failure( 0 );
|
|
t_on_failure( 0 );
|
|
|
|
+ t_on_branch_failure(0);
|
|
t_on_reply(0);
|
|
t_on_reply(0);
|
|
t_on_branch(0);
|
|
t_on_branch(0);
|
|
/* reset the kr status */
|
|
/* reset the kr status */
|
|
@@ -856,9 +887,6 @@ static int mod_init(void)
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
- goto_on_branch_failure = route_lookup(&event_rt, "tm:branch-failure");
|
|
|
|
- if (goto_on_branch_failure >= 0 && event_rt.rlist[goto_on_branch_failure]==0)
|
|
|
|
- goto_on_branch_failure = -1; /* disable */
|
|
|
|
#ifdef WITH_EVENT_LOCAL_REQUEST
|
|
#ifdef WITH_EVENT_LOCAL_REQUEST
|
|
goto_on_local_req=route_lookup(&event_rt, "tm:local-request");
|
|
goto_on_local_req=route_lookup(&event_rt, "tm:local-request");
|
|
if (goto_on_local_req>=0 && event_rt.rlist[goto_on_local_req]==0)
|
|
if (goto_on_local_req>=0 && event_rt.rlist[goto_on_local_req]==0)
|
|
@@ -982,7 +1010,6 @@ static int t_check_status(struct sip_msg* msg, char *p1, char *foo)
|
|
status = int2str( lowest_status , 0);
|
|
status = int2str( lowest_status , 0);
|
|
break;
|
|
break;
|
|
case BRANCH_FAILURE_ROUTE:
|
|
case BRANCH_FAILURE_ROUTE:
|
|
-#warning add the status for branch failure route
|
|
|
|
status = int2str(t->uac[get_t_branch()].last_received, 0);
|
|
status = int2str(t->uac[get_t_branch()].last_received, 0);
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
@@ -1374,6 +1401,13 @@ inline static int w_t_on_failure( struct sip_msg* msg, char *go_to, char *foo)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+inline static int w_t_on_branch_failure( struct sip_msg* msg, char *go_to, char *foo)
|
|
|
|
+{
|
|
|
|
+ t_on_branch_failure( (unsigned int )(long) go_to );
|
|
|
|
+ return 1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
inline static int w_t_on_branch( struct sip_msg* msg, char *go_to, char *foo)
|
|
inline static int w_t_on_branch( struct sip_msg* msg, char *go_to, char *foo)
|
|
{
|
|
{
|
|
t_on_branch( (unsigned int )(long) go_to );
|
|
t_on_branch( (unsigned int )(long) go_to );
|