summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg2009-03-29 16:50:25 +0200
committerAndreas Eversberg2009-03-29 16:50:25 +0200
commitebdd133f07e327072fa310b6b32a97021703a0d4 (patch)
tree70fdb6cf201b1e7cc65666871740e0bc1d0a4ad3
parentchan_lcr: fixed compile problems with newer versions of asterisk (diff)
downloadlcr-ebdd133f07e327072fa310b6b32a97021703a0d4.tar.gz
lcr-ebdd133f07e327072fa310b6b32a97021703a0d4.tar.xz
lcr-ebdd133f07e327072fa310b6b32a97021703a0d4.zip
Added PROGRESS indication in both directions, so early audio is possible.
-> Tones and announcements shall be forwarded. modified: README modified: chan_lcr.c modified: chan_lcr.h
-rw-r--r--README3
-rw-r--r--chan_lcr.c44
-rw-r--r--chan_lcr.h2
3 files changed, 49 insertions, 0 deletions
diff --git a/README b/README
index 5da7a61..fc19664 100644
--- a/README
+++ b/README
@@ -480,3 +480,6 @@ Changes after Version 1.4 release
-> Notifications like diversions are now sent to terminal.
- Added l1hold feature (requires new mISDN and mISDNuser).
- chan_lcr: Fixed compile problem with newer versions.
+- chan_lcr: Open b-channel if asterisk indicates "PROGRESS".
+ -> Also if tones are available, asterisk gets "PROGRESS" indication.
+
diff --git a/chan_lcr.c b/chan_lcr.c
index 5c23337..00c27f8 100644
--- a/chan_lcr.c
+++ b/chan_lcr.c
@@ -1118,6 +1118,34 @@ static void lcr_in_facility(struct chan_call *call, int message_type, union para
}
/*
+ * incoming pattern from LCR
+ */
+static void lcr_in_pattern(struct chan_call *call, int message_type, union parameter *param)
+{
+ union parameter newparam;
+
+ CDEBUG(call, call->ast, "Incomming pattern indication from LCR.\n");
+
+ if (!call->ast) return;
+
+ /* pattern are indicated only once */
+ if (call->has_pattern)
+ return;
+ call->has_pattern = 1;
+
+ /* request bchannel */
+ if (!call->bchannel) {
+ CDEBUG(call, call->ast, "Requesting B-channel.\n");
+ memset(&newparam, 0, sizeof(union parameter));
+ newparam.bchannel.type = BCHANNEL_REQUEST;
+ send_message(MESSAGE_BCHANNEL, call->ref, &newparam);
+ }
+ /* queue PROGRESS, because tones are available */
+ if (call->ast && call->pbx_started)
+ strncat(call->queue_string, "T", sizeof(call->queue_string)-1);
+}
+
+/*
* got dtmf from bchannel (locked state)
*/
void lcr_in_dtmf(struct chan_call *call, int val)
@@ -1354,6 +1382,8 @@ int receive_message(int message_type, unsigned int ref, union parameter *param)
break;
case MESSAGE_PATTERN: // audio available from LCR
+ if (!call->has_pattern)
+ lcr_in_pattern(call, message_type, param);
break;
case MESSAGE_NOPATTERN: // audio not available from LCR
@@ -1572,6 +1602,10 @@ static int queue_send(void)
if (!ast_channel_trylock(ast)) { /* succeed */
while(*p) {
switch (*p) {
+ case 'T':
+ CDEBUG(call, ast, "Sending queued PROGRESS to Asterisk.\n");
+ ast_queue_control(ast, AST_CONTROL_PROGRESS);
+ break;
case 'P':
CDEBUG(call, ast, "Sending queued PROCEEDING to Asterisk.\n");
ast_queue_control(ast, AST_CONTROL_PROCEEDING);
@@ -2246,6 +2280,16 @@ static int lcr_indicate(struct ast_channel *ast, int cond, const void *data, siz
call->state = CHAN_LCR_STATE_IN_ALERTING;
}
break;
+ case AST_CONTROL_PROGRESS:
+ CDEBUG(call, ast, "Received indicate AST_CONTROL_PROGRESS from Asterisk.\n");
+ /* request bchannel */
+ if (!call->bchannel) {
+ CDEBUG(call, ast, "Requesting B-channel.\n");
+ memset(&newparam, 0, sizeof(union parameter));
+ newparam.bchannel.type = BCHANNEL_REQUEST;
+ send_message(MESSAGE_BCHANNEL, call->ref, &newparam);
+ }
+ break;
case -1:
CDEBUG(call, ast, "Received indicate -1.\n");
res = -1;
diff --git a/chan_lcr.h b/chan_lcr.h
index 50e16e5..5ddb4eb 100644
--- a/chan_lcr.h
+++ b/chan_lcr.h
@@ -75,6 +75,8 @@ struct chan_call {
/* flags for bchannel mode */
char queue_string[64];
/* queue for asterisk */
+ int has_pattern;
+ /* pattern are available, PROGRESS has been indicated */
};