Merged revisions 113118 via svnmerge from
authorJason Parker <jparker@digium.com>
Mon, 7 Apr 2008 18:02:51 +0000 (18:02 +0000)
committerJason Parker <jparker@digium.com>
Mon, 7 Apr 2008 18:02:51 +0000 (18:02 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r113118 | qwell | 2008-04-07 13:00:09 -0500 (Mon, 07 Apr 2008) | 8 lines

Allow playback with noanswer (and add earlyrtp option).

(closes issue #9077)
Reported by: pj
Patches:
      earlyrtp.diff uploaded by wedhorn (license 30)
Tested by: pj, qwell, DEA, wedhorn

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@113119 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_skinny.c
configs/skinny.conf.sample

index 25928e7..c0cc7f7 100644 (file)
@@ -1223,6 +1223,7 @@ static struct skinny_device {
        int lastlineinstance;
        int lastcallreference;
        int capability;
+       int earlyrtp;
        struct sockaddr_in addr;
        struct in_addr ourip;
        struct skinny_line *lines;
@@ -2902,6 +2903,7 @@ static struct skinny_device *build_device(const char *cat, struct ast_variable *
                else
                        memset(device_vmexten, 0, sizeof(device_vmexten));
 
+               d->earlyrtp = 1;
                while(v) {
                        if (!strcasecmp(v->name, "host")) {
                                if (ast_get_ip(&d->addr, v->value)) {
@@ -2928,6 +2930,8 @@ static struct skinny_device *build_device(const char *cat, struct ast_variable *
                                ast_copy_string(d->version_id, v->value, sizeof(d->version_id));
                        } else if (!strcasecmp(v->name, "canreinvite")) {
                                canreinvite = ast_true(v->value);
+                       } else if (!strcasecmp(v->name, "earlyrtp")) {
+                               d->earlyrtp = ast_true(v->value);
                        } else if (!strcasecmp(v->name, "nat")) {
                                nat = ast_true(v->value);
                        } else if (!strcasecmp(v->name, "callerid")) {
@@ -3148,6 +3152,9 @@ static void *skinny_newcall(void *data)
                l->hidecallerid ? "" : l->cid_name,
                c->cid.cid_ani ? NULL : l->cid_num);
        ast_setstate(c, AST_STATE_RING);
+       if (!sub->rtp) {
+               start_rtp(sub);
+       }
        res = ast_pbx_run(c);
        if (res) {
                ast_log(LOG_WARNING, "PBX exited non-zero\n");
@@ -3602,45 +3609,61 @@ static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, s
        case AST_CONTROL_RINGING:
                if (ast->_state != AST_STATE_UP) {
                        if (!sub->progress) {
-                               transmit_tone(s, SKINNY_ALERT, l->instance, sub->callid);
+                               if (!d->earlyrtp) {
+                                       transmit_tone(s, SKINNY_ALERT, l->instance, sub->callid);
+                               }
                                transmit_callstate(s, l->instance, SKINNY_RINGOUT, sub->callid);
                                transmit_dialednumber(s, exten, l->instance, sub->callid);
                                transmit_displaypromptstatus(s, "Ring Out", 0, l->instance, sub->callid);
                                transmit_callinfo(s, ast->cid.cid_name, ast->cid.cid_num, exten, exten, l->instance, sub->callid, 2); /* 2 = outgoing from phone */
                                sub->ringing = 1;
-                               break;
+                               if (!d->earlyrtp) {
+                                       break;
+                               }
                        }
                }
-               return -1;
+               return -1; /* Tell asterisk to provide inband signalling */
        case AST_CONTROL_BUSY:
                if (ast->_state != AST_STATE_UP) {
-                       transmit_tone(s, SKINNY_BUSYTONE, l->instance, sub->callid);
+                       if (!d->earlyrtp) {
+                               transmit_tone(s, SKINNY_BUSYTONE, l->instance, sub->callid);
+                       }
                        transmit_callstate(s, l->instance, SKINNY_BUSY, sub->callid);
                        sub->alreadygone = 1;
                        ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
-                       break;
+                       if (!d->earlyrtp) {
+                               break;
+                       }
                }
-               return -1;
+               return -1; /* Tell asterisk to provide inband signalling */
        case AST_CONTROL_CONGESTION:
                if (ast->_state != AST_STATE_UP) {
-                       transmit_tone(s, SKINNY_REORDER, l->instance, sub->callid);
+                       if (!d->earlyrtp) {
+                               transmit_tone(s, SKINNY_REORDER, l->instance, sub->callid);
+                       }
                        transmit_callstate(s, l->instance, SKINNY_CONGESTION, sub->callid);
                        sub->alreadygone = 1;
                        ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
-                       break;
+                       if (!d->earlyrtp) {
+                               break;
+                       }
                }
-               return -1;
+               return -1; /* Tell asterisk to provide inband signalling */
        case AST_CONTROL_PROGRESS:
                if ((ast->_state != AST_STATE_UP) && !sub->progress && !sub->outgoing) {
-                       transmit_tone(s, SKINNY_ALERT, l->instance, sub->callid);
+                       if (!d->earlyrtp) {
+                               transmit_tone(s, SKINNY_ALERT, l->instance, sub->callid);
+                       }
                        transmit_callstate(s, l->instance, SKINNY_PROGRESS, sub->callid);
                        transmit_displaypromptstatus(s, "Call Progress", 0, l->instance, sub->callid);
                        transmit_callinfo(s, ast->cid.cid_name, ast->cid.cid_num, exten, exten, l->instance, sub->callid, 2); /* 2 = outgoing from phone */
                        sub->progress = 1;
-                       break;
+                       if (!d->earlyrtp) {
+                               break;
+                       }
                }
-               return -1;
-       case -1:
+               return -1; /* Tell asterisk to provide inband signalling */
+       case -1:  /* STOP_TONE */
                transmit_tone(s, SKINNY_SILENCE, l->instance, sub->callid);
                break;
        case AST_CONTROL_HOLD:
@@ -3656,7 +3679,7 @@ static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, s
                break;
        default:
                ast_log(LOG_WARNING, "Don't know how to indicate condition %d\n", ind);
-               return -1;
+               return -1; /* Tell asterisk to provide inband signalling */
        }
        return 0;
 }
index 26a6db6..0cfb4fb 100644 (file)
@@ -63,6 +63,11 @@ keepalive=120
 ;jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
 ;-----------------------------------------------------------------------------------
 
+;----------------------------------- DEVICE OPTIONS --------------------------------
+;earlyrtp=1                  ; whether audio signalling should be provided by asterisk
+                             ; (earlyrtp=1) or device generated (earlyrtp=0). 
+                             ; defaults to earlyrtp=1
+;-----------------------------------------------------------------------------------
 
 ; Typical config for 12SP+
 ;[florian]