** **
\*****************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
#include "main.h"
"interface=<interface>[,...]", "Matches if call is received from given interface(s). NOT PORTS!"},
{ "callerid", MATCH_CALLERID, COND_TYPE_STRING,
"callerid=<digits>[-<digits>][,...]", "Matches if caller ID matches or begins with the given (range(s) of) prefixes(s)."},
+ { "callerid2", MATCH_CALLERID2,COND_TYPE_STRING,
+ "callerid2=<digits>[-<digits>][,...]", "Matches the second caller ID (network provided)."},
{ "extension", MATCH_EXTENSION,COND_TYPE_STRING,
"extension=<digits>[-<digits>][,...]", "Matches if caller calls from given (range(s) of) extension(s)."},
{ "dialing", MATCH_DIALING, COND_TYPE_STRING,
"notbusy=<extension>[,...]","Matches if any of the given extension is not busy."},
{ "remote", MATCH_REMOTE, COND_TYPE_STRING,
"remote=<application name>","Matches if remote application is running."},
- { "notremote", MATCH_NOTREMOTE,COND_TYPE_NULL,
+ { "notremote", MATCH_NOTREMOTE,COND_TYPE_STRING,
"notremote=<application name>","Matches if remote application is not running."},
{ NULL, 0, 0, NULL}
};
"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>", "Name of remote application to make call to."},
+ { PARAM_CONTEXT,
+ "context", PARAM_TYPE_STRING,
+ "context=<context>", "Give context parameter to the remote application."},
+ { PARAM_EXTEN,
+ "exten", PARAM_TYPE_STRING,
+ "exten=<extension>", "Give exten parameter to the remote application. (overrides dialed number)"},
{ 0, NULL, 0, NULL, NULL}
};
"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,
{ 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,
/*
* 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;
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")))
{
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]);
/*
* return ruleset by name
*/
-struct route_ruleset *getrulesetbyname(char *name)
+struct route_ruleset *getrulesetbyname(const char *name)
{
struct route_ruleset *ruleset = ruleset_first;
struct route_action *action = NULL;
unsigned long comp_len;
int j, jj;
- char callerid[64], redirid[64];
+ char callerid[64], callerid2[64], redirid[64];
int integer;
char *string;
FILE *tfp;
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(callerid2, numberrize_callerinfo(e_callerinfo.id2, e_callerinfo.ntype2, 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)
string = callerid;
goto match_string_prefix;
+ case MATCH_CALLERID2:
+ string = callerid2;
+ goto match_string_prefix;
+
case MATCH_EXTENSION:
string = e_ext.name;
goto match_string;
break;
case MATCH_REDIRECTED:
- if (e_redirinfo.present != INFO_PRESENT_NULL)
+ if (e_redirinfo.ntype != INFO_NTYPE_NOTPRESENT)
istrue = 1;
break;
case MATCH_DIRECT:
- if (e_redirinfo.present == INFO_PRESENT_NULL)
+ if (e_redirinfo.ntype == INFO_NTYPE_NOTPRESENT)
istrue = 1;
break;
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;
{
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;
}
{
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;