[asterisk-commits] rmudgett: branch group/issue8824 r145291 - in /team/group/issue8824: ./ chann...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 30 18:14:30 CDT 2008
Author: rmudgett
Date: Tue Sep 30 18:14:26 2008
New Revision: 145291
URL: http://svn.digium.com/view/asterisk?view=rev&rev=145291
Log:
sync with trunk, resolve conflicts, reset automerge
Modified:
team/group/issue8824/ (props changed)
team/group/issue8824/CHANGES
team/group/issue8824/channels/chan_misdn.c
team/group/issue8824/channels/chan_sip.c
team/group/issue8824/channels/misdn/isdn_lib.c
team/group/issue8824/channels/misdn/isdn_lib.h
team/group/issue8824/doc/tex/misdn.tex
Propchange: team/group/issue8824/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/issue8824/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Sep 30 18:14:26 2008
@@ -1,1 +1,1 @@
-/trunk:1-145134
+/trunk:1-145247
Modified: team/group/issue8824/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/CHANGES?view=diff&rev=145291&r1=145290&r2=145291
==============================================================================
--- team/group/issue8824/CHANGES (original)
+++ team/group/issue8824/CHANGES Tue Sep 30 18:14:26 2008
@@ -1,6 +1,12 @@
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.6.1 to Asterisk 1.6.2 -------------
------------------------------------------------------------------------------
+
+SIP Changes
+-----------
+ * Added support for SUBSCRIBE/NOTIFY with dialog-info based call pickups.
+ Snom phones use this for call pickup of extensions that the phone is
+ subscribed to.
Dialplan Functions
------------------
Modified: team/group/issue8824/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_misdn.c?view=diff&rev=145291&r1=145290&r2=145291
==============================================================================
--- team/group/issue8824/channels/chan_misdn.c (original)
+++ team/group/issue8824/channels/chan_misdn.c Tue Sep 30 18:14:26 2008
@@ -1193,49 +1193,50 @@
{
switch (fac->Function) {
#ifdef HAVE_MISDN_FAC_RESULT
- case Fac_RESULT:
- chan_misdn_log(0, bc->port," --> Received RESULT Operation\n");
- break;
+ case Fac_RESULT:
+ chan_misdn_log(0, bc->port," --> Received RESULT Operation\n");
+ break;
#endif
#ifdef HAVE_MISDN_FAC_ERROR
- case Fac_ERROR:
- chan_misdn_log(0, bc->port," --> Received Error Operation\n");
- chan_misdn_log(0, bc->port," --> Value:%d Error:%s\n",fac->u.ERROR.errorValue, fac->u.ERROR.error);
- break;
+ case Fac_ERROR:
+ chan_misdn_log(0, bc->port," --> Received Error Operation\n");
+ chan_misdn_log(0, bc->port," --> Value:%d Error:%s\n",fac->u.ERROR.errorValue, fac->u.ERROR.error);
+ break;
#endif
- case Fac_CD:
- chan_misdn_log(1,bc->port," --> calldeflect to: %s, screened: %s\n", fac->u.CDeflection.DeflectedToNumber,
- fac->u.CDeflection.PresentationAllowed ? "yes" : "no");
- break;
- case Fac_AOCDCurrency:
- if (fac->u.AOCDcur.chargeNotAvailable)
- chan_misdn_log(1,bc->port," --> AOCD currency: charge not available\n");
- else if (fac->u.AOCDcur.freeOfCharge)
- chan_misdn_log(1,bc->port," --> AOCD currency: free of charge\n");
- else if (fac->u.AOCDchu.billingId >= 0)
- chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s billingId:%d\n",
- fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
- (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDcur.billingId);
- else
- chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s\n",
- fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
- (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total");
- break;
- case Fac_AOCDChargingUnit:
- if (fac->u.AOCDchu.chargeNotAvailable)
- chan_misdn_log(1,bc->port," --> AOCD charging unit: charge not available\n");
- else if (fac->u.AOCDchu.freeOfCharge)
- chan_misdn_log(1,bc->port," --> AOCD charging unit: free of charge\n");
- else if (fac->u.AOCDchu.billingId >= 0)
- chan_misdn_log(1,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s billingId:%d\n",
- fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDchu.billingId);
- else
- chan_misdn_log(1,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s\n",
- fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total");
- break;
- case Fac_None:
- default:
- chan_misdn_log(1,bc->port," --> unknown facility\n");
+ case Fac_CD:
+ chan_misdn_log(1,bc->port," --> calldeflect to: %s, screened: %s\n", fac->u.CDeflection.DeflectedToNumber,
+ fac->u.CDeflection.PresentationAllowed ? "yes" : "no");
+ break;
+ case Fac_AOCDCurrency:
+ if (fac->u.AOCDcur.chargeNotAvailable)
+ chan_misdn_log(1,bc->port," --> AOCD currency: charge not available\n");
+ else if (fac->u.AOCDcur.freeOfCharge)
+ chan_misdn_log(1,bc->port," --> AOCD currency: free of charge\n");
+ else if (fac->u.AOCDchu.billingId >= 0)
+ chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s billingId:%d\n",
+ fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
+ (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDcur.billingId);
+ else
+ chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s\n",
+ fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
+ (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total");
+ break;
+ case Fac_AOCDChargingUnit:
+ if (fac->u.AOCDchu.chargeNotAvailable)
+ chan_misdn_log(1,bc->port," --> AOCD charging unit: charge not available\n");
+ else if (fac->u.AOCDchu.freeOfCharge)
+ chan_misdn_log(1,bc->port," --> AOCD charging unit: free of charge\n");
+ else if (fac->u.AOCDchu.billingId >= 0)
+ chan_misdn_log(1,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s billingId:%d\n",
+ fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDchu.billingId);
+ else
+ chan_misdn_log(1,bc->port," --> AOCD charging unit: recordedUnits:%d typeOfChargingInfo:%s\n",
+ fac->u.AOCDchu.recordedUnits, (fac->u.AOCDchu.typeOfChargingInfo == 0) ? "subTotal" : "total");
+ break;
+ case Fac_None:
+ default:
+ chan_misdn_log(1,bc->port," --> unknown facility\n");
+ break;
}
}
@@ -1515,7 +1516,7 @@
if (a->argc < 4 || a->argc > 7)
return CLI_SHOWUSAGE;
-
+
if (!strcasecmp(a->argv[3], "on")) {
level = 1;
} else if (!strcasecmp(a->argv[3], "off")) {
@@ -1525,10 +1526,11 @@
}
switch (a->argc) {
- case 4:
+ case 4:
case 5:
{
- int only = 0, i;
+ int i;
+ int only = 0;
if (a->argc == 5) {
if (strncasecmp(a->argv[4], "only", strlen(a->argv[4])))
return CLI_SHOWUSAGE;
@@ -1543,7 +1545,7 @@
ast_cli(a->fd, "changing debug level for all ports to %d%s\n",misdn_debug[0], only?" (only)":"");
}
break;
- case 6:
+ case 6:
case 7:
{
int port;
@@ -1747,8 +1749,6 @@
ast_cli(fd, "[%s] %s (Default: %s)\n\t%s\n", section, name, def, desc);
else
ast_cli(fd, "[%s] %s\n\t%s\n", section, name, desc);
-
- return;
}
static char *handle_cli_misdn_show_config(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -1989,7 +1989,7 @@
static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- struct chan_list *help = NULL;
+ struct chan_list *help;
switch (cmd) {
case CLI_INIT:
@@ -2007,7 +2007,7 @@
help = cl_te;
- ast_cli(a->fd, "Channel List: %p\n", cl_te);
+ ast_cli(a->fd, "Channel List: %p\n", cl_te);
for (; help; help = help->next) {
struct misdn_bchannel *bc = help->bc;
@@ -2053,7 +2053,7 @@
static char *handle_cli_misdn_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- struct chan_list *help = NULL;
+ struct chan_list *help;
switch (cmd) {
case CLI_INIT:
@@ -2132,7 +2132,7 @@
port = misdn_cfg_get_next_port(port)) {
char buf[128];
get_show_stack_details(port, buf);
- ast_cli(a->fd," %s Debug:%d%s\n", buf, misdn_debug[port], misdn_debug_only[port] ? "(only)" : "");
+ ast_cli(a->fd, " %s Debug:%d%s\n", buf, misdn_debug[port], misdn_debug_only[port] ? "(only)" : "");
}
return CLI_SUCCESS;
@@ -2287,6 +2287,9 @@
static char *handle_cli_misdn_send_restart(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
+ int port;
+ int channel;
+
switch (cmd) {
case CLI_INIT:
e->command = "misdn send restart";
@@ -2301,10 +2304,14 @@
if (a->argc < 4 || a->argc > 5)
return CLI_SHOWUSAGE;
- if (a->argc == 5)
- misdn_lib_send_restart(atoi(a->argv[3]), atoi(a->argv[4]));
- else
- misdn_lib_send_restart(atoi(a->argv[3]), -1);
+ port = atoi(a->argv[3]);
+
+ if (a->argc == 5) {
+ channel = atoi(a->argv[4]);
+ misdn_lib_send_restart(port, channel);
+ } else {
+ misdn_lib_send_restart(port, -1);
+ }
return CLI_SUCCESS;
}
@@ -2386,7 +2393,7 @@
return CLI_SUCCESS;
}
- tmp->toggle_ec = tmp->toggle_ec?0:1;
+ tmp->toggle_ec = tmp->toggle_ec ? 0 : 1;
if (tmp->toggle_ec) {
#ifdef MISDN_1_2
@@ -2695,10 +2702,15 @@
{
struct ast_channel *ast;
struct misdn_bchannel *bc;
- int port, hdlc = 0;
- char lang[BUFFERSIZE + 1], localmusicclass[BUFFERSIZE + 1], faxdetect[BUFFERSIZE + 1];
- char buf[256], buf2[256];
- ast_group_t pg, cg;
+ int port;
+ int hdlc = 0;
+ char lang[BUFFERSIZE + 1];
+ char localmusicclass[BUFFERSIZE + 1];
+ char faxdetect[BUFFERSIZE + 1];
+ char buf[256];
+ char buf2[256];
+ ast_group_t pg;
+ ast_group_t cg;
if (!ch) {
ast_log(LOG_WARNING, "Cannot configure without chanlist\n");
@@ -2728,10 +2740,10 @@
misdn_cfg_get(port, MISDN_CFG_SENDDTMF, &bc->send_dtmf, sizeof(bc->send_dtmf));
- misdn_cfg_get( port, MISDN_CFG_ASTDTMF, &ch->ast_dsp, sizeof(int));
+ misdn_cfg_get(port, MISDN_CFG_ASTDTMF, &ch->ast_dsp, sizeof(int));
if (ch->ast_dsp) {
- ch->ignore_dtmf=1;
+ ch->ignore_dtmf = 1;
}
misdn_cfg_get(port, MISDN_CFG_NEED_MORE_INFOS, &bc->need_more_infos, sizeof(bc->need_more_infos));
@@ -3127,7 +3139,7 @@
struct chan_list *p;
const char *tmp;
- if (!ast || ! (p = MISDN_ASTERISK_TECH_PVT(ast)) ) return -1;
+ if (!ast || !(p = MISDN_ASTERISK_TECH_PVT(ast))) return -1;
chan_misdn_log(1, p ? (p->bc ? p->bc->port : 0) : 0, "* ANSWER:\n");
@@ -3143,7 +3155,6 @@
}
tmp = pbx_builtin_getvar_helper(p->ast, "CRYPT_KEY");
-
if (!ast_strlen_zero(tmp)) {
chan_misdn_log(1, p->bc->port, " --> Connection will be BF crypted\n");
ast_copy_string(p->bc->crypt_key, tmp, sizeof(p->bc->crypt_key));
@@ -3188,8 +3199,8 @@
struct chan_list *p;
struct misdn_bchannel *bc;
char buf[2] = { digit, 0 };
-
- if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast))) return -1;
+
+ if (!ast || !(p = MISDN_ASTERISK_TECH_PVT(ast))) return -1;
bc = p->bc;
chan_misdn_log(1, bc ? bc->port : 0, "* IND : Digit %c\n", digit);
@@ -3220,7 +3231,7 @@
if ( bc->send_dtmf )
send_digit_to_chan(p,digit);
break;
-}
+ }
return 0;
}
@@ -3287,7 +3298,7 @@
p->state = MISDN_ALERTING;
chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d\n", p->bc->pid);
misdn_lib_send_event( p->bc, EVENT_ALERTING);
-
+
if (p->other_ch && p->other_ch->bc) {
if (misdn_inband_avail(p->other_ch->bc)) {
chan_misdn_log(2, p->bc->port, " --> other End is mISDN and has inband info available\n");
@@ -3302,8 +3313,8 @@
chan_misdn_log(3, p->bc->port, " --> * SEND: State Ring pid:%d\n", p->bc->pid);
ast_setstate(ast, AST_STATE_RINGING);
-
- if ( !p->bc->nt && (p->originator == ORG_MISDN) && !p->incoming_early_audio )
+
+ if (!p->bc->nt && (p->originator == ORG_MISDN) && !p->incoming_early_audio)
chan_misdn_log(2, p->bc->port, " --> incoming_early_audio off\n");
else
return -1;
@@ -3440,13 +3451,13 @@
stop_bc_tones(p);
bc->out_cause = ast->hangupcause ? ast->hangupcause : AST_CAUSE_NORMAL_CLEARING;
-
- if ( (varcause = pbx_builtin_getvar_helper(ast, "HANGUPCAUSE")) ||
- (varcause = pbx_builtin_getvar_helper(ast, "PRI_CAUSE"))) {
+
+ if ((varcause = pbx_builtin_getvar_helper(ast, "HANGUPCAUSE")) ||
+ (varcause = pbx_builtin_getvar_helper(ast, "PRI_CAUSE"))) {
int tmpcause = atoi(varcause);
bc->out_cause = tmpcause ? tmpcause : AST_CAUSE_NORMAL_CLEARING;
}
-
+
chan_misdn_log(1, bc->port,
"* IND : HANGUP\tpid:%d context:%s dialed:%s caller:\"%s\" <%s> State:%s\n",
p->bc ? p->bc->pid : -1,
@@ -3474,25 +3485,25 @@
case MISDN_DIALING:
start_bc_tones(p);
hanguptone_indicate(p);
-
- p->state=MISDN_CLEANING;
+
+ p->state = MISDN_CLEANING;
if (bc->need_disconnect)
misdn_lib_send_event( bc, EVENT_DISCONNECT);
break;
case MISDN_CALLING_ACKNOWLEDGE:
start_bc_tones(p);
hanguptone_indicate(p);
-
+
if (bc->need_disconnect)
misdn_lib_send_event( bc, EVENT_DISCONNECT);
break;
-
+
case MISDN_ALERTING:
case MISDN_PROGRESS:
case MISDN_PROCEEDING:
if (p->originator != ORG_AST)
hanguptone_indicate(p);
-
+
/*p->state=MISDN_CLEANING;*/
if (bc->need_disconnect)
misdn_lib_send_event( bc, EVENT_DISCONNECT);
@@ -3523,7 +3534,7 @@
case MISDN_BUSY:
break;
-
+
case MISDN_HOLD_DISCONNECT:
/* need to send release here */
chan_misdn_log(1, bc->port, " --> cause %d\n", bc->cause);
@@ -3547,7 +3558,7 @@
}
p->state = MISDN_CLEANING;
-
+
chan_misdn_log(3, bc->port, " --> Channel: %s hanguped new state:%s\n", ast->name, misdn_get_ch_state(p));
return 0;
@@ -3779,7 +3790,7 @@
ast_debug(1, "write2mISDN %p %d bytes: ", p, frame->samples);
- for (i = 0; i < max ; i++)
+ for (i = 0; i < max; i++)
ast_debug(1, "%2.2x ", ((char*) frame->data.ptr)[i]);
}
#endif
@@ -3811,7 +3822,7 @@
} else {
/*transmit without jitterbuffer*/
- i=misdn_lib_tx2misdn_frm(ch->bc, frame->data.ptr, frame->samples);
+ i = misdn_lib_tx2misdn_frm(ch->bc, frame->data.ptr, frame->samples);
}
return 0;
@@ -4010,7 +4021,6 @@
struct chan_list *cl;
cl = ast_calloc(1, sizeof(*cl));
-
if (!cl) {
chan_misdn_log(-1, 0, "misdn_request: malloc failed!");
return NULL;
@@ -4140,7 +4150,6 @@
}
}
} while (!newbc && robin_channel != rr->channel);
-
} else {
for (port = misdn_cfg_get_next_port(0); port > 0;
port = misdn_cfg_get_next_port(port)) {
@@ -4312,7 +4321,6 @@
}
tmp = ast_channel_alloc(1, state, cid_num, cid_name, "", exten, "", 0, "%s/%s%d-u%d", misdn_type, c ? "" : "tmp", chan_offset + c, glob_channel++);
-
if (tmp) {
chan_misdn_log(2, 0, " --> * NEW CHANNEL dialed:%s caller:%s\n", exten, callerid);
@@ -4348,7 +4356,6 @@
if (pipe(chlist->pipe) < 0)
ast_log(LOG_ERROR, "Pipe failed\n");
-
ast_channel_set_fd(tmp, 0, chlist->pipe[0]);
if (state == AST_STATE_RING)
@@ -4404,9 +4411,9 @@
bc->caller.name,
bc->caller.number);
for (;help; help = help->next) {
- chan_misdn_log(4, bc->port, "$$$ find_holded: --> holded:%d channel:%d\n", help->state==MISDN_HOLDED, help->hold_info.channel);
- if ( (help->state == MISDN_HOLDED) &&
- (help->hold_info.port == bc->port) )
+ chan_misdn_log(4, bc->port, "$$$ find_holded: --> holded:%d channel:%d\n", help->state == MISDN_HOLDED, help->hold_info.channel);
+ if ((help->state == MISDN_HOLDED) &&
+ (help->hold_info.port == bc->port))
return help;
}
chan_misdn_log(6, bc->port,
@@ -4534,7 +4541,7 @@
/** Isdn asks us to release channel, pendant to misdn_hangup **/
static void release_chan(struct misdn_bchannel *bc) {
- struct ast_channel *ast=NULL;
+ struct ast_channel *ast = NULL;
ast_mutex_lock(&release_lock);
{
@@ -4603,9 +4610,8 @@
} else {
/* chan is already cleaned, so exiting */
}
-
- ast_mutex_unlock(&release_lock);
- }
+ }
+ ast_mutex_unlock(&release_lock);
/*** release end **/
}
@@ -4748,7 +4754,9 @@
/*! \brief Import parameters from the dialplan environment variables */
void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)
{
- const char *tmp = pbx_builtin_getvar_helper(chan, "MISDN_PID");
+ const char *tmp;
+
+ tmp = pbx_builtin_getvar_helper(chan, "MISDN_PID");
if (tmp) {
ch->other_pid = atoi(tmp);
chan_misdn_log(3, bc->port, " --> IMPORT_PID: importing pid:%s\n", tmp);
@@ -4772,8 +4780,9 @@
}
tmp = pbx_builtin_getvar_helper(chan, "MISDN_KEYPAD");
- if (tmp)
+ if (tmp) {
ast_copy_string(bc->keypad, tmp, sizeof(bc->keypad));
+ }
}
/*! \brief Export parameters to the dialplan environment variables */
@@ -4794,8 +4803,9 @@
pbx_builtin_setvar_helper(chan, "MISDN_URATE", tmp);
}
- if (bc->uulen)
+ if (bc->uulen) {
pbx_builtin_setvar_helper(chan, "MISDN_USERUSER", bc->uu);
+ }
if (!ast_strlen_zero(bc->keypad))
pbx_builtin_setvar_helper(chan, "MISDN_KEYPAD", bc->keypad);
@@ -4963,7 +4973,9 @@
case EVENT_DTMF_TONE:
{
/* sending INFOS as DTMF-Frames :) */
- struct ast_frame fr = { 0, };
+ struct ast_frame fr;
+
+ memset(&fr, 0, sizeof(fr));
fr.frametype = AST_FRAME_DTMF;
fr.subclass = bc->dtmf ;
fr.src = NULL;
@@ -5000,7 +5012,7 @@
ast_copy_string(bc->info_dad, bc->keypad, sizeof(bc->info_dad));
}
- strncat(bc->dialed.number,bc->info_dad, sizeof(bc->dialed.number) - strlen(bc->dialed.number) - 1);
+ strncat(bc->dialed.number, bc->info_dad, sizeof(bc->dialed.number) - strlen(bc->dialed.number) - 1);
ast_copy_string(ch->ast->exten, bc->dialed.number, sizeof(ch->ast->exten));
/* Check for Pickup Request first */
@@ -5060,6 +5072,7 @@
/* sending INFOS as DTMF-Frames :) */
struct ast_frame fr;
int digits;
+
memset(&fr, 0, sizeof(fr));
fr.frametype = AST_FRAME_DTMF;
fr.subclass = bc->info_dad[0] ;
@@ -5104,21 +5117,6 @@
}
}
- if (!bc->nt && ! msn_valid) {
- chan_misdn_log(1, bc->port, " --> Ignoring Call, its not in our MSN List\n");
- return RESPONSE_IGNORE_SETUP; /* Ignore MSNs which are not in our List */
- }
-
- if (bc->cw) {
- int cause;
- chan_misdn_log(0, bc->port, " --> Call Waiting on PMP sending RELEASE_COMPLETE\n");
- misdn_cfg_get(bc->port, MISDN_CFG_REJECT_CAUSE, &cause, sizeof(cause));
- bc->out_cause = cause ? cause : AST_CAUSE_NORMAL_CLEARING;
- return RESPONSE_RELEASE_SETUP;
- }
-
- print_bearer(bc);
-
if (!bc->nt && ! msn_valid) {
chan_misdn_log(1, bc->port, " --> Ignoring Call, its not in our MSN List\n");
return RESPONSE_IGNORE_SETUP; /* Ignore MSNs which are not in our List */
@@ -5372,7 +5370,6 @@
break;
case EVENT_PROCEEDING:
{
-
if (misdn_cap_is_speech(bc->capability) &&
misdn_inband_avail(bc) ) {
start_bc_tones(ch);
@@ -5387,7 +5384,6 @@
}
break;
case EVENT_PROGRESS:
-
if (bc->channel)
update_name(ch->ast, bc->port, bc->channel);
@@ -5606,7 +5602,7 @@
{
if (ch->bc->AOCD_need_export)
export_aoc_vars(ch->originator, ch->ast, ch->bc);
- if (!misdn_cap_is_speech(ch->bc->capability) ) {
+ if (!misdn_cap_is_speech(ch->bc->capability)) {
struct ast_frame frame;
/*In Data Modes we queue frames*/
frame.frametype = AST_FRAME_VOICE; /*we have no data frames yet*/
@@ -5657,7 +5653,7 @@
}
break;
case EVENT_TIMEOUT:
- {
+ {
if (ch && bc)
chan_misdn_log(1, bc->port, "--> state: %s\n", misdn_get_ch_state(ch));
@@ -5826,7 +5822,7 @@
#ifdef HAVE_MISDN_FAC_ERROR
case Fac_ERROR:
#endif
- break;
+ break;
default:
chan_misdn_log(0, bc->port," --> not yet handled: facility type:%d\n", bc->fac_in.Function);
}
@@ -5986,8 +5982,8 @@
" takes taps as optarg (32,64,128,256)\n"
" e! - Disable echo cancelation on this channel\n"
" f - Enable fax detection\n"
- " h - Make digital outgoing call\n"
- " h1 - Make HDLC mode digital outgoing call\n"
+ " h - Make digital outgoing call\n"
+ " h1 - Make HDLC mode digital outgoing call\n"
" i - Ignore detected DTMF tones, don't signal them to Asterisk,\n"
" they will be transported inband.\n"
" jb - Set jitter buffer length, optarg is length\n"
@@ -6428,15 +6424,13 @@
jb->state_empty = 0;
jb->bytes_wrote = 0;
jb->samples = ast_malloc(size * sizeof(char));
-
if (!jb->samples) {
ast_free(jb);
chan_misdn_log(-1, 0, "No free Mem for jb->samples\n");
return NULL;
}
-
+
jb->ok = ast_malloc(size * sizeof(char));
-
if (!jb->ok) {
ast_free(jb->samples);
ast_free(jb);
@@ -6495,7 +6489,7 @@
rp = wp;
for (j = 0; j < jb->upper_threshold; j++)
- rp = rp != 0 ? rp - 1 : jb->size - 1;
+ rp = (rp != 0) ? rp - 1 : jb->size - 1;
jb->rp = rp;
jb->state_full = 0;
jb->state_empty = 1;
Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=145291&r1=145290&r2=145291
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Tue Sep 30 18:14:26 2008
@@ -2004,6 +2004,7 @@
static int sip_refer_allocate(struct sip_pvt *p);
static void ast_quiet_chan(struct ast_channel *chan);
static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target);
+static int do_magic_pickup(struct ast_channel *channel, const char *extension, const char *context);
/*!
* \brief generic function for determining if a correct transport is being
* used to contact a peer
@@ -9441,11 +9442,28 @@
break;
case DIALOG_INFO_XML: /* SNOM subscribes in this format */
ast_str_append(&tmp, 0, "<?xml version=\"1.0\"?>\n");
- ast_str_append(&tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">\n", p->dialogver++, full ? "full":"partial", mto);
- if ((state & AST_EXTENSION_RINGING) && global_notifyringing)
- ast_str_append(&tmp, 0, "<dialog id=\"%s\" direction=\"recipient\">\n", p->exten);
- else
+ ast_str_append(&tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">\n", p->dialogver++, full ? "full" : "partial", mto);
+ if ((state & AST_EXTENSION_RINGING) && global_notifyringing) {
+ /* We create a fake call-id which the phone will send back in an INVITE
+ Replaces header which we can grab and do some magic with. */
+ ast_str_append(&tmp, 0,
+ "<dialog id=\"%s\" call-id=\"pickup-%s\" direction=\"recipient\">\n"
+ "<remote>\n"
+ /* Note that the identity and target elements for the local participant are currently
+ (and may forever be) incorrect since we have no reliable way to get at that information
+ at the moment. Luckily the phone seems to still live happily without it being correct */
+ "<identity>%s</identity>\n"
+ "<target uri=\"%s\"/>\n"
+ "</remote>\n"
+ "<local>\n"
+ "<identity>%s</identity>\n"
+ "<target uri=\"%s\"/>\n"
+ "</local>\n",
+ p->exten, p->callid,
+ mto, mto, mto, mto);
+ } else {
ast_str_append(&tmp, 0, "<dialog id=\"%s\">\n", p->exten);
+ }
ast_str_append(&tmp, 0, "<state>%s</state>\n", statestring);
if (state == AST_EXTENSION_ONHOLD) {
ast_str_append(&tmp, 0, "<local>\n<target uri=\"%s\">\n"
@@ -17494,6 +17512,27 @@
return sip_uri_params_cmp(params1, params2);
}
+static int do_magic_pickup(struct ast_channel *channel, const char *extension, const char *context)
+{
+ struct ast_str *str = ast_str_alloca(AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2);
+ struct ast_app *pickup = pbx_findapp("Pickup");
+
+ if (!pickup) {
+ ast_log(LOG_ERROR, "Unable to perform pickup: Application 'Pickup' not loaded (app_directed_pickup.so).\n");
+ return -1;
+ }
+
+ ast_str_set(&str, 0, "%s@%s", extension, context);
+
+ ast_debug(2, "About to call Pickup(%s)\n", str->str);
+
+ /* There is no point in capturing the return value since pickup_exec
+ doesn't return anything meaningful unless the passed data is an empty
+ string (which in our case it will not be) */
+ pbx_exec(channel, pickup, str->str);
+
+ return 0;
+}
/*!
* \brief Handle incoming INVITE request
@@ -17522,6 +17561,12 @@
int st_interval = 0; /* Session-Timer negotiated refresh interval */
enum st_refresher st_ref; /* Session-Timer session refresher */
int dlg_min_se = -1;
+ struct {
+ char exten[AST_MAX_EXTENSION];
+ char context[AST_MAX_CONTEXT];
+ } pickup = {
+ .exten = "",
+ };
st_ref = SESSION_TIMER_REFRESHER_AUTO;
/* Find out what they support */
@@ -17658,14 +17703,36 @@
}
}
- if (sipdebug)
- ast_debug(4, "Invite/replaces: Will use Replace-Call-ID : %s Fromtag: %s Totag: %s\n", replace_id, fromtag ? fromtag : "<no from tag>", totag ? totag : "<no to tag>");
-
-
- /* Try to find call that we are replacing
- If we have a Replaces header, we need to cancel that call if we succeed with this call
- */
- if ((p->refer->refer_call = get_sip_pvt_byid_locked(replace_id, totag, fromtag)) == NULL) {
+ if (sipdebug)
+ ast_debug(4, "Invite/replaces: Will use Replace-Call-ID : %s Fromtag: %s Totag: %s\n",
+ replace_id,
+ fromtag ? fromtag : "<no from tag>",
+ totag ? totag : "<no to tag>");
+
+ /* Try to find call that we are replacing.
+ If we have a Replaces header, we need to cancel that call if we succeed with this call.
+ First we cheat a little and look for a magic call-id from phones that support
+ dialog-info+xml so we can do technology independent pickup... */
+ if (strncmp(replace_id, "pickup-", 7) == 0) {
+ struct sip_pvt *subscription = NULL;
+ replace_id += 7; /* Worst case we are looking at \0 */
+
+ if ((subscription = get_sip_pvt_byid_locked(replace_id, NULL, NULL)) == NULL) {
+ ast_log(LOG_NOTICE, "Unable to find subscription with call-id: %s\n", replace_id);
+ transmit_response_reliable(p, "481 Call Leg Does Not Exist (Replaces)", req);
+ error = 1;
+ } else {
+ ast_log(LOG_NOTICE, "Trying to pick up %s@%s\n", subscription->exten, subscription->context);
+ ast_copy_string(pickup.exten, subscription->exten, sizeof(pickup.exten));
+ ast_copy_string(pickup.context, subscription->context, sizeof(pickup.context));
+ sip_pvt_unlock(subscription);
+ if (subscription->owner) {
+ ast_channel_unlock(subscription->owner);
+ }
+ }
+ }
+
+ if (!error && ast_strlen_zero(pickup.exten) && (p->refer->refer_call = get_sip_pvt_byid_locked(replace_id, totag, fromtag)) == NULL) {
ast_log(LOG_NOTICE, "Supervised transfer attempted to replace non-existent call id (%s)!\n", replace_id);
transmit_response_reliable(p, "481 Call Leg Does Not Exist (Replaces)", req);
error = 1;
@@ -17684,7 +17751,7 @@
error = 1;
}
- if (!error && !p->refer->refer_call->owner) {
+ if (!error && ast_strlen_zero(pickup.exten) && !p->refer->refer_call->owner) {
/* Oops, someting wrong anyway, no owner, no call */
ast_log(LOG_NOTICE, "Supervised transfer attempted to replace non-existing call id (%s)!\n", replace_id);
/* Check for better return code */
@@ -17692,7 +17759,7 @@
error = 1;
}
- if (!error && p->refer->refer_call->owner->_state != AST_STATE_RINGING && p->refer->refer_call->owner->_state != AST_STATE_RING && p->refer->refer_call->owner->_state != AST_STATE_UP ) {
+ if (!error && ast_strlen_zero(pickup.exten) && p->refer->refer_call->owner->_state != AST_STATE_RINGING && p->refer->refer_call->owner->_state != AST_STATE_RING && p->refer->refer_call->owner->_state != AST_STATE_UP) {
ast_log(LOG_NOTICE, "Supervised transfer attempted to replace non-ringing or active call id (%s)!\n", replace_id);
transmit_response_reliable(p, "603 Declined (Replaces)", req);
error = 1;
@@ -18015,10 +18082,28 @@
p->lastinvite = seqno;
if (replace_id) { /* Attended transfer or call pickup - we're the target */
- /* Go and take over the target call */
- if (sipdebug)
- ast_debug(4, "Sending this call to the invite/replcaes handler %s\n", p->callid);
- return handle_invite_replaces(p, req, debug, seqno, sin);
+ if (!ast_strlen_zero(pickup.exten)) {
+ append_history(p, "Xfer", "INVITE/Replace received");
+
+ /* Let the caller know we're giving it a shot */
+ transmit_response(p, "100 Trying", req);
+ ast_setstate(c, AST_STATE_RING);
+
+ /* Do the pickup itself */
+ ast_channel_unlock(c);
+ *nounlock = 1;
+ do_magic_pickup(c, pickup.exten, pickup.context);
+
+ /* Now we're either masqueraded or we failed to pickup, in either case we... */
+ ast_hangup(c);
+
+ return 0;
+ } else {
+ /* Go and take over the target call */
+ if (sipdebug)
+ ast_debug(4, "Sending this call to the invite/replcaes handler %s\n", p->callid);
+ return handle_invite_replaces(p, req, debug, seqno, sin);
+ }
}
Modified: team/group/issue8824/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/misdn/isdn_lib.c?view=diff&rev=145291&r1=145290&r2=145291
==============================================================================
--- team/group/issue8824/channels/misdn/isdn_lib.c (original)
+++ team/group/issue8824/channels/misdn/isdn_lib.c Tue Sep 30 18:14:26 2008
@@ -1004,7 +1004,10 @@
int setup_bc(struct misdn_bchannel *bc)
{
unsigned char buff[1025];
- int midev, channel, b_stid, i;
+ int midev;
+ int channel;
+ int b_stid;
+ int i;
mISDN_pid_t pid;
int ret;
@@ -1896,7 +1899,8 @@
switch(hh->prim){
case CC_RETRIEVE|INDICATION:
{
- struct misdn_bchannel *bc, *hold_bc;
+ struct misdn_bchannel *bc;
+ struct misdn_bchannel *hold_bc;
iframe_t frm; /* fake te frm to add callref to global callreflist */
frm.dinfo = hh->dinfo;
@@ -4070,7 +4074,7 @@
} else {
iframe_t *frm = (iframe_t *)msg->data;
struct misdn_bchannel *bc = find_bc_by_l3id(stack, frm->dinfo);
- if (bc)
+ if (bc)
send_msg(glob_mgr->midev, bc, msg);
else {
if (frm->dinfo == MISDN_ID_GLOBAL || frm->dinfo == MISDN_ID_DUMMY ) {
@@ -4309,7 +4313,6 @@
void manager_bchannel_deactivate(struct misdn_bchannel * bc)
{
-
struct misdn_stack *stack=get_stack_by_bc(bc);
iframe_t dact;
char buf[128];
@@ -4691,7 +4694,8 @@
cb_log(4,bc->port, "Splitting bc:%x in conf:%d\n",bc->addr,conf_id);
}
-void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2) {
+void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2)
+{
int conf_id = bc1->pid + 1;
struct misdn_bchannel *bc_list[] = { bc1, bc2, NULL };
struct misdn_bchannel **bc;
Modified: team/group/issue8824/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/misdn/isdn_lib.h?view=diff&rev=145291&r1=145290&r2=145291
==============================================================================
--- team/group/issue8824/channels/misdn/isdn_lib.h (original)
+++ team/group/issue8824/channels/misdn/isdn_lib.h Tue Sep 30 18:14:26 2008
@@ -480,7 +480,7 @@
/*! \brief This is used as a pending bridge join request for when bc_state becomes BCHAN_ACTIVATED */
enum bchannel_state next_bc_state;
- /*! \brief Bridgign conference ID */
+ /*! \brief Bridging conference ID */
int conf_id;
/*! \brief TRUE if this channel is on hold */
Modified: team/group/issue8824/doc/tex/misdn.tex
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/doc/tex/misdn.tex?view=diff&rev=145291&r1=145290&r2=145291
==============================================================================
--- team/group/issue8824/doc/tex/misdn.tex (original)
+++ team/group/issue8824/doc/tex/misdn.tex Tue Sep 30 18:14:26 2008
@@ -65,8 +65,7 @@
To compile and install this driver, you'll need at least one mISDN Driver and
the mISDNuser package. Chan\_misdn works with both, the current release version
-and the development (svn trunk) version of Asterisk. mISDNuser and mISDN must
-be fetched from cvs.isdn4linux.de.
+and the development (svn trunk) version of Asterisk.
You should use Kernels $>$= 2.6.9
@@ -138,14 +137,15 @@
takes taps as optarg (32,64,128,256)
e! - Disable echo cancelation on this channel
f - Enable fax detection
- h - Make digital outgoing call
- h1 - Make HDLC mode digital outgoing call
+ h - Make digital outgoing call
+ h1 - Make HDLC mode digital outgoing call
i - Ignore detected DTMF tones, don't signal them to Asterisk,
they will be transported inband.
jb - Set jitter buffer length, optarg is length
jt - Set jitter buffer upper threshold, optarg is threshold
jn - Disable jitter buffer
- n - Don't have mISDN detect DTMF tones on called channel
+ n - Disable mISDN DSP on channel.
+ Disables: echo cancel, DTMF detection, and volume control.
p - Caller ID presentation,
optarg is either 'allowed' or 'restricted'
s - Send Non-inband DTMF as inband
More information about the asterisk-commits
mailing list