X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=route.c;h=29381c2d2a339f93d4cb2bdba38f494024c5277a;hp=724c4a44f7cedc1b5985e7f81d493117f2c4e8c7;hb=ee848d3a9e333b3b91c0e40679c9d0512d511fc2;hpb=d2ffecef264949e36341e87f8e1ff41a8effb1f2 diff --git a/route.c b/route.c index 724c4a4..29381c2 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} }; @@ -235,6 +231,12 @@ struct param_defs param_defs[] = { { PARAM_APPLICATION, "application",PARAM_TYPE_STRING, "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, @@ -749,7 +751,7 @@ void ruleset_debug(struct route_ruleset *ruleset_start) /* * parse ruleset */ -static char *read_string(char *p, char *key, int key_size, char *special) +static char *read_string(char *p, char *key, int key_size, const char *special) { key[0] = 0; @@ -873,7 +875,7 @@ struct route_ruleset *ruleset_parse(void) j<<=1; } - SPRINT(filename[0], "%s/routing.conf", INSTALL_DATA); + SPRINT(filename[0], "%s/routing.conf", CONFIG_DATA); if (!(fp[0]=fopen(filename[0],"r"))) { @@ -941,7 +943,7 @@ struct route_ruleset *ruleset_parse(void) if (key[0] == '/') SCPY(filename[nesting+1], key); else - SPRINT(filename[nesting+1], "%s/%s", INSTALL_DATA, key); + SPRINT(filename[nesting+1], "%s/%s", CONFIG_DATA, key); if (!(fp[nesting+1]=fopen(filename[nesting+1],"r"))) { PERROR("Cannot open %s\n", filename[nesting+1]); @@ -1920,7 +1922,7 @@ struct route_ruleset *ruleset_parse(void) /* * return ruleset by name */ -struct route_ruleset *getrulesetbyname(char *name) +struct route_ruleset *getrulesetbyname(const char *name) { struct route_ruleset *ruleset = ruleset_first; @@ -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) @@ -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>0) { 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>0) 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>0) break; mISDNport = mISDNport->next;