[asterisk-commits] branch crichter/0.3.0 r24877 - in
/team/crichter/0.3.0: channels/ channels/mi...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon May 8 04:10:49 MST 2006
Author: crichter
Date: Fri May 5 11:36:07 2006
New Revision: 24877
URL: http://svn.digium.com/view/asterisk?rev=24877&view=rev
Log:
Added option far_alerting. This option makes it possible to generate a Ringing on other channels if they feel that they should have inband ringing, but there is non in reality. I need this due to the fact that asterisk has not the possibility to transmit progress indicators thus chan_sip and others do not know wether they should generate a Rining tone themselves if they receive AST_CONTROL_RINGING..
Modified:
team/crichter/0.3.0/channels/chan_misdn.c
team/crichter/0.3.0/channels/misdn/chan_misdn_config.h
team/crichter/0.3.0/channels/misdn/isdn_lib.c
team/crichter/0.3.0/channels/misdn/isdn_lib.h
team/crichter/0.3.0/channels/misdn_config.c
team/crichter/0.3.0/configs/misdn.conf.sample
Modified: team/crichter/0.3.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_misdn.c?rev=24877&r1=24876&r2=24877&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_misdn.c (original)
+++ team/crichter/0.3.0/channels/chan_misdn.c Fri May 5 11:36:07 2006
@@ -111,6 +111,7 @@
TONE_NONE=0,
TONE_DIAL,
TONE_ALERTING,
+ TONE_FAR_ALERTING,
TONE_BUSY,
TONE_CUSTOM,
TONE_FILE
@@ -184,6 +185,8 @@
int zero_read_cnt;
int dropped_frame_cnt;
+
+ int far_alerting;
const struct tone_zone_sound *ts;
@@ -1264,6 +1267,8 @@
misdn_cfg_get( port, MISDN_CFG_NEED_MORE_INFOS, &bc->need_more_infos, sizeof(int));
+ misdn_cfg_get( port, MISDN_CFG_FAR_ALERTING, &ch->far_alerting, sizeof(int));
+
int hdlc=0;
misdn_cfg_get( port, MISDN_CFG_HDLC, &hdlc, sizeof(int));
@@ -1703,6 +1708,8 @@
}
p->state = MISDN_CONNECTED;
+ misdn_lib_echo(p->bc,0);
+ tone_indicate(p, TONE_NONE);
if ( ast_strlen_zero(p->bc->cad) ) {
chan_misdn_log(2,p->bc->port," --> empty cad using dad\n");
@@ -2056,7 +2063,6 @@
read(tmp->pipe[0],blah,sizeof(blah));
-
len = misdn_ibuf_usedcount(tmp->bc->astbuf);
if (!len) {
@@ -2140,7 +2146,7 @@
if ( !(frame->subclass & prefformat)) {
chan_misdn_log(-1, ch->bc->port, "Got Unsupported Frame with Format:%d\n", frame->subclass);
- return -1;
+ return 0;
}
@@ -2183,7 +2189,7 @@
return 0;
}
-
+
chan_misdn_log(9, ch->bc->port, "Sending :%d bytes 2 MISDN\n",frame->samples);
/*if speech flip bits*/
if ( misdn_cap_is_speech(ch->bc->capability) )
@@ -2313,6 +2319,13 @@
chan_misdn_log(2,cl->bc->port," --> Ring\n");
ts=ast_get_indication_tone(ast->zone,"ring");
misdn_lib_tone_generator_stop(cl->bc);
+ break;
+ case TONE_FAR_ALERTING:
+ /* VERY UGLY HACK, BECAUSE CHAN_SIP DOES NOT GENERATE TONES */
+ chan_misdn_log(2,cl->bc->port," --> Ring\n");
+ ts=ast_get_indication_tone(ast->zone,"ring");
+ misdn_lib_tone_generator_start(cl->bc);
+ misdn_lib_echo(cl->bc,1);
break;
case TONE_BUSY:
chan_misdn_log(2,cl->bc->port," --> Busy\n");
@@ -2609,7 +2622,9 @@
tmp->nativeformats = prefformat;
tmp->readformat = format;
+ tmp->rawreadformat = format;
tmp->writeformat = format;
+ tmp->rawwriteformat = format;
tmp->tech_pvt = chlist;
@@ -3531,7 +3546,15 @@
cb_log(1,bc->port,"Set State Ringing\n");
if ( misdn_cap_is_speech(bc->capability) && misdn_inband_avail(bc)) {
+ cb_log(1,bc->port,"Starting Tones, we have inband Data\n");
start_bc_tones(ch);
+ } else {
+ cb_log(1,bc->port,"We have no inband Data, the other end must create ringing\n");
+ if (ch->far_alerting) {
+ cb_log(1,bc->port,"The other end can not do ringing eh ?.. we must do all ourself..");
+ start_bc_tones(ch);
+ tone_indicate(ch, TONE_FAR_ALERTING);
+ }
}
}
break;
@@ -3541,6 +3564,9 @@
struct ast_channel *bridged=AST_BRIDGED_P(ch->ast);
+ misdn_lib_echo(bc,0);
+ tone_indicate(ch, TONE_NONE);
+
if (bridged && strcasecmp(bridged->tech->type,"mISDN")) {
struct chan_list *bridged_ch=MISDN_ASTERISK_TECH_PVT(bridged);
Modified: team/crichter/0.3.0/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/chan_misdn_config.h?rev=24877&r1=24876&r2=24877&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/chan_misdn_config.h (original)
+++ team/crichter/0.3.0/channels/misdn/chan_misdn_config.h Fri May 5 11:36:07 2006
@@ -23,6 +23,7 @@
/* port config items */
MISDN_CFG_FIRST = 0,
MISDN_CFG_GROUPNAME, /* char[] */
+ MISDN_CFG_FAR_ALERTING, /* int (bool) */
MISDN_CFG_RXGAIN, /* int */
MISDN_CFG_TXGAIN, /* int */
MISDN_CFG_TE_CHOOSE_CHANNEL, /* int (bool) */
Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.c?rev=24877&r1=24876&r2=24877&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Fri May 5 11:36:07 2006
@@ -3065,8 +3065,6 @@
int queue_l2l3(msg_t *msg) {
iframe_t *frm= (iframe_t*)msg->data;
struct misdn_stack *stack;
- int err=0;
-
stack=find_stack_by_addr( frm->addr );
@@ -3262,7 +3260,6 @@
stack=stack->next ) {
while ( (msg=msg_dequeue(&stack->upqueue)) ) {
- int res=0;
/** Handle L2/3 Signalling after bchans **/
if (!handle_frm_nt(msg)) {
/* Maybe it's TE */
@@ -3849,3 +3846,13 @@
}
}
+
+
+
+void misdn_lib_echo(struct misdn_bchannel *bc, int onoff)
+{
+ cb_log(1,bc->port, " --> ECHO %s\n", onoff?"ON":"OFF");
+ manager_ph_control(bc, onoff?CMX_ECHO_ON:CMX_ECHO_OFF, 0);
+}
+
+
Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.h?rev=24877&r1=24876&r2=24877&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.h Fri May 5 11:36:07 2006
@@ -392,6 +392,8 @@
void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
+void misdn_lib_echo(struct misdn_bchannel *bc, int onoff);
+
unsigned char * flip_buf_bits ( unsigned char * buf , int len);
int misdn_lib_is_ptp(int port);
Modified: team/crichter/0.3.0/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn_config.c?rev=24877&r1=24876&r2=24877&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn_config.c (original)
+++ team/crichter/0.3.0/channels/misdn_config.c Fri May 5 11:36:07 2006
@@ -87,6 +87,7 @@
{ "rxgain", MISDN_CFG_RXGAIN, MISDN_CTYPE_INT, "0", NONE },
{ "txgain", MISDN_CFG_TXGAIN, MISDN_CTYPE_INT, "0", NONE },
{ "te_choose_channel", MISDN_CFG_TE_CHOOSE_CHANNEL, MISDN_CTYPE_BOOL, "no", NONE },
+ { "far_alerting", MISDN_CFG_FAR_ALERTING, MISDN_CTYPE_BOOL, "no", NONE },
{ "pmp_l1_check", MISDN_CFG_PMP_L1_CHECK, MISDN_CTYPE_BOOL, "yes", NONE },
{ "hdlc", MISDN_CFG_HDLC, MISDN_CTYPE_BOOL, "no", NONE },
{ "context", MISDN_CFG_CONTEXT, MISDN_CTYPE_STR, "default", NONE },
Modified: team/crichter/0.3.0/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/configs/misdn.conf.sample?rev=24877&r1=24876&r2=24877&view=diff
==============================================================================
--- team/crichter/0.3.0/configs/misdn.conf.sample (original)
+++ team/crichter/0.3.0/configs/misdn.conf.sample Fri May 5 11:36:07 2006
@@ -106,6 +106,12 @@
; Either if we should produce DTMF Tones ourselve
;
senddtmf=yes
+
+;
+; If we should generate Ringing for chan_sip and others
+;
+far_alerting=no
+
; Prefixes for national and international, those are put before the
; oad if an according dialplan is set by the other end.
More information about the asterisk-commits
mailing list