add ton support

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@678 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2009-03-02 22:05:11 +00:00
parent 5b6a3b74cf
commit 60a793c03c
2 changed files with 28 additions and 4 deletions

View File

@ -979,6 +979,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
if ((var = switch_event_get_header(var_event, "openzap_outbound_ton")) || (var = switch_core_get_variable("openzap_outbound_ton"))) {
if (!strcasecmp(var, "national")) {
caller_data.ani.type = Q931_TON_NATIONAL;
} else if (!strcasecmp(var, "international")) {
caller_data.ani.type = Q931_TON_INTERNATIONAL;
} else if (!strcasecmp(var, "local")) {
caller_data.ani.type = Q931_TON_SUBSCRIBER_NUMBER;
} else if (!strcasecmp(var, "unknown")) {
caller_data.ani.type = Q931_TON_UNKNOWN;
}
} else {
caller_data.ani.type = outbound_profile->destination_number_ton;

View File

@ -412,20 +412,38 @@ static __inline__ void state_advance(zap_channel_t *zchan)
case ZAP_CHANNEL_STATE_DIALING:
if (isdn_data) {
struct pri_sr *sr;
int dp;
const char *val;
if (!(call = pri_new_call(isdn_data->spri.pri))) {
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_RESTART);
return;
}
dp = zchan->caller_data.ani.type;
switch(dp) {
case Q931_TON_NATIONAL:
dp = PRI_NATIONAL_ISDN;
break;
case Q931_TON_INTERNATIONAL:
dp = PRI_INTERNATIONAL_ISDN;
break;
case Q931_TON_SUBSCRIBER_NUMBER:
dp = PRI_LOCAL_ISDN;
break;
default:
dp = isdn_data->dp;
}
zchan->call_data = call;
sr = pri_sr_new();
assert(sr);
pri_sr_set_channel(sr, zchan->chan_id, 0, 0);
pri_sr_set_bearer(sr, 0, isdn_data->l1);
pri_sr_set_called(sr, zchan->caller_data.ani.digits, isdn_data->dp, 1);
pri_sr_set_caller(sr, zchan->caller_data.cid_num.digits, zchan->caller_data.cid_name, isdn_data->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
pri_sr_set_redirecting(sr, zchan->caller_data.cid_num.digits, isdn_data->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
pri_sr_set_called(sr, zchan->caller_data.ani.digits, dp, 1);
pri_sr_set_caller(sr, zchan->caller_data.cid_num.digits, zchan->caller_data.cid_name, dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
pri_sr_set_redirecting(sr, zchan->caller_data.cid_num.digits, dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
if (pri_setup(isdn_data->spri.pri, call, sr)) {
zchan->caller_data.hangup_cause = ZAP_CAUSE_DESTINATION_OUT_OF_ORDER;