X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=route.c;h=743e37de5ce9921f3dbe8644becf17b53c4a2367;hp=2546b187263c44f282aa4d2d2a7a051799546649;hb=89d3a5de4769faafa46efb83e1e35db5b40f1309;hpb=db6990e487255e8b206ef67d8d99fa74849a9a11 diff --git a/route.c b/route.c index 2546b18..743e37d 100644 --- a/route.c +++ b/route.c @@ -9,10 +9,6 @@ ** ** \*****************************************************************************/ -#include -#include -#include -#include #include "main.h" @@ -94,7 +90,7 @@ struct cond_defs cond_defs[] = { "notbusy=[,...]","Matches if any of the given extension is not busy."}, { "remote", MATCH_REMOTE, COND_TYPE_STRING, "remote=","Matches if remote application is running."}, - { "notremote", MATCH_NOTREMOTE,COND_TYPE_NULL, + { "notremote", MATCH_NOTREMOTE,COND_TYPE_STRING, "notremote=","Matches if remote application is not running."}, { NULL, 0, 0, NULL} }; @@ -234,7 +230,13 @@ struct param_defs param_defs[] = { "strip", "Remove digits that were required to match this rule."}, { PARAM_APPLICATION, "application",PARAM_TYPE_STRING, - "application", "Name of remote application to make call to."}, + "application=", "Name of remote application to make call to."}, + { PARAM_CONTEXT, + "context", PARAM_TYPE_STRING, + "context=", "Give context parameter to the remote application."}, + { PARAM_EXTEN, + "exten", PARAM_TYPE_STRING, + "exten=", "Give exten parameter to the remote application. (overrides dialed number)"}, { 0, NULL, 0, NULL, NULL} }; @@ -253,7 +255,7 @@ struct action_defs action_defs[] = { "Same as 'extern'"}, { ACTION_REMOTE, "remote", &EndpointAppPBX::action_init_remote, &EndpointAppPBX::action_dialing_remote, &EndpointAppPBX::action_hangup_call, - PARAM_CONNECT | PARAM_APPLICATION | PARAM_TIMEOUT, + PARAM_CONNECT | PARAM_APPLICATION | PARAM_CONTEXT | PARAM_EXTEN | PARAM_TIMEOUT, "Call is routed to Remote application, like Asterisk."}, { ACTION_VBOX_RECORD, "vbox-record",&EndpointAppPBX::action_init_call, &EndpointAppPBX::action_dialing_vbox_record, &EndpointAppPBX::action_hangup_call, @@ -286,7 +288,7 @@ struct action_defs action_defs[] = { { ACTION_REPLY, "reply", &EndpointAppPBX::action_init_redial_reply, &EndpointAppPBX::action_dialing_reply, NULL, PARAM_CONNECT | PARAM_SELECT, - "Caller replies. (last incomming call(s))"}, + "Caller replies. (last incoming call(s))"}, { ACTION_POWERDIAL, "powerdial", NULL, &EndpointAppPBX::action_dialing_powerdial, NULL, PARAM_CONNECT | PARAM_DELAY | PARAM_LIMIT | PARAM_TIMEOUT, @@ -1952,7 +1954,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) struct route_rule *rule = ruleset->rule_first; struct route_cond *cond; struct route_action *action = NULL; - unsigned long comp_len; + unsigned int comp_len; int j, jj; char callerid[64], redirid[64]; int integer; @@ -1966,8 +1968,8 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) e_match_timeout = 0; /* no timeout */ e_match_to_action = NULL; - SCPY(callerid, numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype)); - SCPY(redirid, numberrize_callerinfo(e_redirinfo.id, e_redirinfo.ntype)); + SCPY(callerid, numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype, options.national, options.international)); + SCPY(redirid, numberrize_callerinfo(e_redirinfo.id, e_redirinfo.ntype, options.national, options.international)); PDEBUG(DEBUG_ROUTE, "parsing ruleset '%s'\n", ruleset->name); while(rule) @@ -2135,9 +2137,9 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) case MATCH_FREE: case MATCH_NOTFREE: - if (!(comp_len = (unsigned long)strchr(cond->string_value, ':'))) + if (!(comp_len = (unsigned int)strchr(cond->string_value, ':'))) break; - comp_len = comp_len-(unsigned long)cond->string_value; + comp_len = comp_len-(unsigned int)cond->string_value; avail = 0; mISDNport = mISDNport_first; while(mISDNport) @@ -2145,7 +2147,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) if (mISDNport->ifport) if (strlen(mISDNport->ifport->interface->name) == comp_len) if (!strncasecmp(mISDNport->ifport->interface->name, cond->string_value, comp_len)) - if (!mISDNport->ptp || mISDNport->l2link) + if (!mISDNport->l2hold || mISDNport->l2link) { j = 0; jj = mISDNport->b_num; @@ -2177,7 +2179,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) { if (mISDNport->ifport) if (!strcasecmp(mISDNport->ifport->interface->name, cond->string_value)) - if (!mISDNport->ptp || mISDNport->l2link) /* break if one is up */ + if (!mISDNport->l2hold || mISDNport->l2link) break; mISDNport = mISDNport->next; } @@ -2191,7 +2193,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) { if (mISDNport->ifport) if (!strcasecmp(mISDNport->ifport->interface->name, cond->string_value)) - if (!mISDNport->ptp || mISDNport->l2link) /* break if one is up */ + if (!mISDNport->l2hold || mISDNport->l2link) break; mISDNport = mISDNport->next; @@ -2268,7 +2270,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) match_string_prefix: comp_len = strlen(cond->string_value); /* because we must reach value's length */ /* we must have greater or equal length to values */ - if ((unsigned long)strlen(string) < comp_len) + if ((unsigned int)strlen(string) < comp_len) { /* special case for unfinished dialing */ if (cond->match == MATCH_DIALING)