[asterisk-commits] rmudgett: branch rmudgett/ss7_27_knk r415581 - /team/rmudgett/ss7_27_knk/chan...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 9 15:25:49 CDT 2014
Author: rmudgett
Date: Mon Jun 9 15:25:42 2014
New Revision: 415581
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=415581
Log:
chan_dahdi/sig_ss7: Update for libss7 API change and some other fixes.
* Fixed some locking issues and blocking problems.
* Added the missing networkroutedprefix. Thanks to Arto Kuiri for
discovering.
* Set redirect_counter if the remote switch sent only info_counter, so we
can have a working redirection info. Thanks to Arto Kuiri for
discovering.
* Fix connected_num presentation.
* Do not send REL for outgoing calls if we have not yet sent an IAM -
fixes ChanIsAvail. Thanks to Johann Steinwendtner.
* When sending RLC do not free the call if there is non-call related
messages like blocking.
SS7-27
Reported by: adomjan
Patches:
SS7-27_dahdi_27_v12b.diff (license #5506) patch uploaded by Kaloyan Kovachev
Review: https://reviewboard.asterisk.org/r/2170/
Modified:
team/rmudgett/ss7_27_knk/channels/chan_dahdi.c
team/rmudgett/ss7_27_knk/channels/sig_ss7.c
Modified: team/rmudgett/ss7_27_knk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_dahdi.c?view=diff&rev=415581&r1=415580&r2=415581
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_dahdi.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_dahdi.c Mon Jun 9 15:25:42 2014
@@ -11980,6 +11980,7 @@
ast_copy_string(ss7->ss7.nationalprefix, conf->ss7.ss7.nationalprefix, sizeof(ss7->ss7.nationalprefix));
ast_copy_string(ss7->ss7.subscriberprefix, conf->ss7.ss7.subscriberprefix, sizeof(ss7->ss7.subscriberprefix));
ast_copy_string(ss7->ss7.unknownprefix, conf->ss7.ss7.unknownprefix, sizeof(ss7->ss7.unknownprefix));
+ ast_copy_string(ss7->ss7.networkroutedprefix, conf->ss7.ss7.networkroutedprefix, sizeof(ss7->ss7.networkroutedprefix));
ss7->ss7.called_nai = conf->ss7.ss7.called_nai;
ss7->ss7.calling_nai = conf->ss7.ss7.calling_nai;
Modified: team/rmudgett/ss7_27_knk/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/sig_ss7.c?view=diff&rev=415581&r1=415580&r2=415581
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/sig_ss7.c (original)
+++ team/rmudgett/ss7_27_knk/channels/sig_ss7.c Mon Jun 9 15:25:42 2014
@@ -289,7 +289,13 @@
if (!p->owner) {
p->owner = ast;
}
- p->do_hangup = SS7_HANGUP_SEND_REL;
+
+ if (p->outgoing) {
+ p->do_hangup = SS7_HANGUP_FREE_CALL;
+ } else {
+ p->do_hangup = SS7_HANGUP_SEND_REL;
+ }
+
ast_channel_transfercapability_set(ast, transfercapability);
pbx_builtin_setvar_helper(ast, "TRANSFERCAPABILITY",
ast_transfercapability2str(transfercapability));
@@ -734,11 +740,11 @@
}
sig_ss7_lock_owner(linkset, i);
- if (linkset->pvts[i]->owner
- && ast_channel_state(linkset->pvts[i]->owner) == AST_STATE_DIALING
- && linkset->pvts[i]->call_level < SIG_SS7_CALL_LEVEL_PROCEEDING) {
- ast_channel_hangupcause_set(linkset->pvts[i]->owner, SS7_CAUSE_TRY_AGAIN);
- ast_softhangup_nolock(linkset->pvts[i]->owner, AST_SOFTHANGUP_DEV);
+ if (linkset->pvts[i]->owner) {
+ if (ast_channel_state(linkset->pvts[i]->owner) == AST_STATE_DIALING
+ && linkset->pvts[i]->call_level < SIG_SS7_CALL_LEVEL_PROCEEDING) {
+ ast_channel_hangupcause_set(linkset->pvts[i]->owner, SS7_CAUSE_TRY_AGAIN);
+ }
ast_channel_unlock(linkset->pvts[i]->owner);
}
}
@@ -784,11 +790,9 @@
}
if (!p->ss7call) {
- p->ss7call = isup_new_call(p->ss7->ss7);
+ p->ss7call = isup_new_call(p->ss7->ss7, p->cic, p->dpc, 0);
if (!p->ss7call) {
return 0;
- } else {
- isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc);
}
}
return 1;
@@ -1512,12 +1516,15 @@
ast_setstate(p->owner, AST_STATE_RINGING);
if (!ast_strlen_zero(e->cpg.connected_num)) {
struct ast_party_connected_line ast_connected;
+ char connected_num[AST_MAX_EXTENSION];
ast_party_connected_line_init(&ast_connected);
ast_connected.id.number.presentation =
ss7_pres_scr2cid_pres(e->cpg.connected_presentation_ind,
e->cpg.connected_screening_ind);
- ast_connected.id.number.str = ast_strdup(e->cpg.connected_num);
+ ss7_apply_plan_to_number(connected_num, sizeof(connected_num),
+ linkset, e->cpg.connected_num, e->cpg.connected_nai);
+ ast_connected.id.number.str = ast_strdup(connected_num);
ast_connected.id.number.valid = 1;
ast_channel_queue_connected_line_update(p->owner, &ast_connected, NULL);
ast_party_connected_line_free(&ast_connected);
@@ -1725,32 +1732,29 @@
*/
ast_assert(!p->owner && p->call_level == SIG_SS7_CALL_LEVEL_IDLE);
- /* Mark channel as in use so no outgoing call will steal it. */
- p->call_level = SIG_SS7_CALL_LEVEL_ALLOCATED;
- p->ss7call = e->iam.call;
-
- if (p->locallyblocked) {
- isup_clear_callflags(ss7, p->ss7call, ISUP_GOT_IAM);
- p->ss7call = isup_free_call_if_clear(ss7, p->ss7call);
- p->call_level = SIG_SS7_CALL_LEVEL_IDLE;
- sig_ss7_unlock_private(p);
- ast_log(LOG_WARNING, "Got IAM on locally blocked CIC %d DPC %d, ignore\n", e->iam.cic, e->iam.opc);
- break;
- }
if (p->remotelyblocked) {
ast_log(LOG_NOTICE, "Got IAM on remotely blocked CIC %d DPC %d remove blocking\n", e->iam.cic, e->iam.opc);
sig_ss7_set_remotelyblocked(p, 0, SS7_BLOCKED_MAINTENANCE | SS7_BLOCKED_HARDWARE);
sig_ss7_set_inservice(p, 1);
}
- isup_set_call_dpc(p->ss7call, p->dpc);
-
- if (!p->inservice || p->inalarm) {
- /* Circuit cannot take a call now. */
+ if (!sig_ss7_is_chan_available(p)) {
+ /* Circuit is likely blocked or in alarm. */
isup_rel(ss7, e->iam.call, AST_CAUSE_NORMAL_CIRCUIT_CONGESTION);
+ if (p->locallyblocked) {
+ isup_clear_callflags(ss7, e->iam.call, ISUP_GOT_IAM);
+ p->ss7call = isup_free_call_if_clear(ss7, e->iam.call);
+ ast_log(LOG_WARNING, "Got IAM on locally blocked CIC %d DPC %d, ignore\n", e->iam.cic, e->iam.opc);
+ }
sig_ss7_unlock_private(p);
break;
}
+
+ /* Mark channel as in use so no outgoing call will steal it. */
+ p->call_level = SIG_SS7_CALL_LEVEL_ALLOCATED;
+ p->ss7call = e->iam.call;
+
+ isup_set_call_dpc(p->ss7call, p->dpc);
if ((p->use_callerid) && (!ast_strlen_zero(e->iam.calling_party_num))) {
ss7_apply_plan_to_number(p->cid_num, sizeof(p->cid_num), linkset, e->iam.calling_party_num, e->iam.calling_nai);
@@ -1812,6 +1816,9 @@
p->redirect_info_ind = e->iam.redirect_info_ind;
p->redirect_info_orig_reas = e->iam.redirect_info_orig_reas;
p->redirect_info_counter = e->iam.redirect_info_counter;
+ if (p->redirect_info_counter && !p->redirect_counter) {
+ p->redirect_counter = p->redirect_info_counter;
+ }
p->redirect_info_reas = e->iam.redirect_info_reas;
p->cug_indicator = e->iam.cug_indicator;
p->cug_interlock_code = e->iam.cug_interlock_code;
@@ -2089,10 +2096,11 @@
sig_ss7_lock_owner(linkset, chanpos);
if (!p->owner) {
p->ss7call = isup_free_call_if_clear(ss7, e->blo.call);
- } else if (e->blo.got_sent_msg & ISUP_SENT_IAM) {
- /* Q.784 6.2.2 */
- ast_channel_hangupcause_set(p->owner, SS7_CAUSE_TRY_AGAIN);
- ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_DEV);
+ } else {
+ if (e->blo.got_sent_msg & ISUP_SENT_IAM) {
+ /* Q.784 6.2.2 */
+ ast_channel_hangupcause_set(p->owner, SS7_CAUSE_TRY_AGAIN);
+ }
ast_channel_unlock(p->owner);
}
sig_ss7_unlock_private(p);
@@ -2175,18 +2183,23 @@
sig_ss7_lock_owner(linkset, chanpos);
if (p->owner) {
struct ast_party_connected_line ast_connected;
+ char connected_num[AST_MAX_EXTENSION];
ast_party_connected_line_init(&ast_connected);
if (e->e == ISUP_EVENT_ANM) {
ast_connected.id.number.presentation = ss7_pres_scr2cid_pres(
e->anm.connected_presentation_ind,
e->anm.connected_screening_ind);
- ast_connected.id.number.str = ast_strdup(e->anm.connected_num);
+ ss7_apply_plan_to_number(connected_num, sizeof(connected_num),
+ linkset, e->anm.connected_num, e->anm.connected_nai);
+ ast_connected.id.number.str = ast_strdup(connected_num);
} else {
ast_connected.id.number.presentation = ss7_pres_scr2cid_pres(
e->con.connected_presentation_ind,
e->con.connected_screening_ind);
- ast_connected.id.number.str = ast_strdup(e->con.connected_num);
+ ss7_apply_plan_to_number(connected_num, sizeof(connected_num),
+ linkset, e->con.connected_num, e->con.connected_nai);
+ ast_connected.id.number.str = ast_strdup(connected_num);
}
ast_connected.id.number.valid = 1;
ast_connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
@@ -2628,7 +2641,13 @@
ast_mutex_lock(&p->ss7->lock);
available = sig_ss7_is_chan_available(p);
if (available) {
- p->call_level = SIG_SS7_CALL_LEVEL_ALLOCATED;
+ p->ss7call = isup_new_call(p->ss7->ss7, p->cic, p->dpc, 1);
+ if (!p->ss7call) {
+ ast_log(LOG_ERROR, "Unable to allocate new SS7 call!\n");
+ available = 0;
+ } else {
+ p->call_level = SIG_SS7_CALL_LEVEL_ALLOCATED;
+ }
}
ast_mutex_unlock(&p->ss7->lock);
@@ -2866,13 +2885,6 @@
return -1;
}
- p->ss7call = isup_new_call(p->ss7->ss7);
- if (!p->ss7call) {
- ss7_rel(p->ss7);
- ast_log(LOG_ERROR, "Unable to allocate new SS7 call!\n");
- return -1;
- }
-
called_nai_strip = 0;
ss7_called_nai = p->ss7->called_nai;
if (ss7_called_nai == SS7_NAI_DYNAMIC) { /* compute dynamically */
@@ -2894,7 +2906,6 @@
p->use_callingpres ? cid_pres2ss7screen(ast_channel_connected(ast)->id.number.presentation) : SS7_SCREENING_USER_PROVIDED);
isup_set_oli(p->ss7call, ast_channel_connected(ast)->ani2);
- isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc);
/* Set the charge number if it is set */
charge_str = pbx_builtin_getvar_helper(ast, "SS7_CHARGE_NUMBER");
@@ -2995,6 +3006,7 @@
}
p->call_level = SIG_SS7_CALL_LEVEL_SETUP;
+ p->do_hangup = SS7_HANGUP_SEND_REL;
isup_iam(p->ss7->ss7, p->ss7call);
sig_ss7_set_dialing(p, 1);
ast_setstate(ast, AST_STATE_DIALING);
@@ -3014,8 +3026,6 @@
*/
int sig_ss7_hangup(struct sig_ss7_chan *p, struct ast_channel *ast)
{
- int res = 0;
-
if (!ast_channel_tech_pvt(ast)) {
ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
return 0;
@@ -3056,9 +3066,8 @@
break;
case SS7_HANGUP_SEND_RLC:
isup_rlc(p->ss7->ss7, p->ss7call);
- isup_free_call(p->ss7->ss7, p->ss7call);
- p->ss7call = NULL;
p->do_hangup = SS7_HANGUP_DO_NOTHING;
+ p->ss7call = isup_free_call_if_clear(p->ss7->ss7, p->ss7call);
break;
case SS7_HANGUP_FREE_CALL:
p->do_hangup = SS7_HANGUP_DO_NOTHING;
@@ -3076,7 +3085,7 @@
}
ss7_rel(p->ss7);
- return res;
+ return 0;
}
/*!
@@ -3288,6 +3297,7 @@
/* Release the allocated channel. Only have to deal with the linkset lock. */
ast_mutex_lock(&p->ss7->lock);
p->call_level = SIG_SS7_CALL_LEVEL_IDLE;
+ isup_free_call(p->ss7->ss7, p->ss7call);
ast_mutex_unlock(&p->ss7->lock);
}
return ast;
More information about the asterisk-commits
mailing list