aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-19 17:49:38 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-19 17:49:38 +0000
commitcc3938c1989d0b9f6a907ee2d64f2f66a01b2e29 (patch)
tree3fe50ce72af12ead588e9b25a6bf636f67b0993d /channels
parent397418eb0c2c20f83505c9af8d5bb8aa89cab8af (diff)
Merge the changes from the /team/group/vldtmf_fixup branch.
The main bug being addressed here is a problem introduced when two SIP channels using SIP INFO dtmf have their media directly bridged. So, when a DTMF END frame comes into Asterisk from an incoming INFO message, Asterisk would try to emulate a digit of some length by first sending a DTMF BEGIN frame and sending a DTMF END later timed off of incoming audio. However, since there was no audio coming in, the DTMF_END was never generated. This caused DTMF based features to no longer work. To fix this, the core now knows when a channel doesn't care about DTMF BEGIN frames (such as a SIP channel sending INFO dtmf). If this is the case, then Asterisk will not emulate a digit of some length, and will instead just pass through the single DTMF END event. Channel drivers also now get passed the length of the digit to their digit_end callback. This improves SIP INFO support even further by enabling us to put the real digit duration in the INFO message instead of a hard coded 250ms. Also, for an incoming INFO message, the duration is read from the frame and passed into the core instead of just getting ignored. (issue #8597, maybe others...) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@51311 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c6
-rw-r--r--channels/chan_alsa.c7
-rw-r--r--channels/chan_features.c6
-rw-r--r--channels/chan_gtalk.c24
-rw-r--r--channels/chan_h323.c4
-rw-r--r--channels/chan_iax2.c4
-rw-r--r--channels/chan_local.c5
-rw-r--r--channels/chan_mgcp.c4
-rw-r--r--channels/chan_misdn.c2
-rw-r--r--channels/chan_oss.c7
-rw-r--r--channels/chan_phone.c10
-rw-r--r--channels/chan_sip.c69
-rw-r--r--channels/chan_skinny.c4
-rw-r--r--channels/chan_zap.c4
14 files changed, 103 insertions, 53 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 484f33333..5f3e3bc5d 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -238,7 +238,7 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
static int agent_devicestate(void *data);
static void agent_logoff_maintenance(struct agent_pvt *p, char *loginchan, long logintime, const char *uniqueid, char *logcommand);
static int agent_digit_begin(struct ast_channel *ast, char digit);
-static int agent_digit_end(struct ast_channel *ast, char digit);
+static int agent_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
static int agent_call(struct ast_channel *ast, char *dest, int timeout);
static int agent_hangup(struct ast_channel *ast);
static int agent_answer(struct ast_channel *ast);
@@ -617,12 +617,12 @@ static int agent_digit_begin(struct ast_channel *ast, char digit)
return res;
}
-static int agent_digit_end(struct ast_channel *ast, char digit)
+static int agent_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
ast_mutex_lock(&p->lock);
- ast_senddigit_end(p->chan, digit);
+ ast_senddigit_end(p->chan, digit, duration);
ast_mutex_unlock(&p->lock);
return res;
}
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index 3d819bb32..e74df21cb 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -187,7 +187,7 @@ static int nosound = 0;
/* ZZ */
static struct ast_channel *alsa_request(const char *type, int format, void *data, int *cause);
-static int alsa_digit(struct ast_channel *c, char digit);
+static int alsa_digit(struct ast_channel *c, char digit, unsigned int duration);
static int alsa_text(struct ast_channel *c, const char *text);
static int alsa_hangup(struct ast_channel *c);
static int alsa_answer(struct ast_channel *c);
@@ -487,10 +487,11 @@ static int soundcard_init(void)
return readdev;
}
-static int alsa_digit(struct ast_channel *c, char digit)
+static int alsa_digit(struct ast_channel *c, char digit, unsigned int duration)
{
ast_mutex_lock(&alsalock);
- ast_verbose(" << Console Received digit %c >> \n", digit);
+ ast_verbose(" << Console Received digit %c of duration %u ms >> \n",
+ digit, duration);
ast_mutex_unlock(&alsalock);
return 0;
}
diff --git a/channels/chan_features.c b/channels/chan_features.c
index b41867fa2..89fe1f903 100644
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -96,7 +96,7 @@ static AST_LIST_HEAD_STATIC(features, feature_pvt);
static struct ast_channel *features_request(const char *type, int format, void *data, int *cause);
static int features_digit_begin(struct ast_channel *ast, char digit);
-static int features_digit_end(struct ast_channel *ast, char digit);
+static int features_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
static int features_call(struct ast_channel *ast, char *dest, int timeout);
static int features_hangup(struct ast_channel *ast);
static int features_answer(struct ast_channel *ast);
@@ -318,7 +318,7 @@ static int features_digit_begin(struct ast_channel *ast, char digit)
return res;
}
-static int features_digit_end(struct ast_channel *ast, char digit)
+static int features_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
struct feature_pvt *p = ast->tech_pvt;
int res = -1;
@@ -328,7 +328,7 @@ static int features_digit_end(struct ast_channel *ast, char digit)
ast_mutex_lock(&p->lock);
x = indexof(p, ast, 0);
if (!x && p->subchan)
- res = ast_senddigit_end(p->subchan, digit);
+ res = ast_senddigit_end(p->subchan, digit, duration);
ast_mutex_unlock(&p->lock);
return res;
}
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index 59f40cc61..530af5b25 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -173,7 +173,9 @@ AST_MUTEX_DEFINE_STATIC(gtalklock); /*!< Protect the interface list (of gtalk_pv
/* Forward declarations */
static struct ast_channel *gtalk_request(const char *type, int format, void *data, int *cause);
-static int gtalk_digit(struct ast_channel *ast, char digit);
+static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration);
+static int gtalk_digit_begin(struct ast_channel *ast, char digit);
+static int gtalk_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
static int gtalk_call(struct ast_channel *ast, char *dest, int timeout);
static int gtalk_hangup(struct ast_channel *ast);
static int gtalk_answer(struct ast_channel *ast);
@@ -198,8 +200,8 @@ static const struct ast_channel_tech gtalk_tech = {
.description = "Gtalk Channel Driver",
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
.requester = gtalk_request,
- .send_digit_begin = gtalk_digit,
- .send_digit_end = gtalk_digit,
+ .send_digit_begin = gtalk_digit_begin,
+ .send_digit_end = gtalk_digit_end,
.bridge = ast_rtp_bridge,
.call = gtalk_call,
.hangup = gtalk_hangup,
@@ -1341,7 +1343,17 @@ static int gtalk_indicate(struct ast_channel *ast, int condition, const void *da
return res;
}
-static int gtalk_digit(struct ast_channel *ast, char digit)
+static int gtalk_digit_begin(struct ast_channel *chan, char digit)
+{
+ return gtalk_digit(chan, digit, 0);
+}
+
+static int gtalk_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
+{
+ return gtalk_digit(chan, digit, duration);
+}
+
+static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration)
{
struct gtalk_pvt *p = ast->tech_pvt;
struct gtalk *client = p->parent;
@@ -1376,8 +1388,8 @@ static int gtalk_digit(struct ast_channel *ast, char digit)
iks_insert_node(gtalk, dtmf);
ast_mutex_lock(&p->lock);
- if(ast->dtmff.frametype == AST_FRAME_DTMF) {
- ast_verbose("Sending 250ms dtmf!\n");
+ if (ast->dtmff.frametype == AST_FRAME_DTMF) {
+ ast_log(LOG_DEBUG, "Sending 250ms dtmf!\n");
} else if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN) {
iks_insert_attrib(dtmf, "action", "button-down");
} else if (ast->dtmff.frametype == AST_FRAME_DTMF_END) {
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 294d1b59e..cf4e89f64 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -234,7 +234,7 @@ static int h323_do_reload(void);
static struct ast_channel *oh323_request(const char *type, int format, void *data, int *cause);
static int oh323_digit_begin(struct ast_channel *c, char digit);
-static int oh323_digit_end(struct ast_channel *c, char digit);
+static int oh323_digit_end(struct ast_channel *c, char digit, unsigned int duration);
static int oh323_call(struct ast_channel *c, char *dest, int timeout);
static int oh323_hangup(struct ast_channel *c);
static int oh323_answer(struct ast_channel *c);
@@ -545,7 +545,7 @@ static int oh323_digit_begin(struct ast_channel *c, char digit)
* Send (play) the specified digit to the channel.
*
*/
-static int oh323_digit_end(struct ast_channel *c, char digit)
+static int oh323_digit_end(struct ast_channel *c, char digit, unsigned int duration)
{
struct oh323_pvt *pvt = (struct oh323_pvt *) c->tech_pvt;
char *token;
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index c13ab667a..6204dcc23 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -776,7 +776,7 @@ static int iax2_answer(struct ast_channel *c);
static int iax2_call(struct ast_channel *c, char *dest, int timeout);
static int iax2_devicestate(void *data);
static int iax2_digit_begin(struct ast_channel *c, char digit);
-static int iax2_digit_end(struct ast_channel *c, char digit);
+static int iax2_digit_end(struct ast_channel *c, char digit, unsigned int duration);
static int iax2_do_register(struct iax2_registry *reg);
static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan);
static int iax2_hangup(struct ast_channel *c);
@@ -2388,7 +2388,7 @@ static int iax2_digit_begin(struct ast_channel *c, char digit)
return send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_DTMF_BEGIN, digit, 0, NULL, 0, -1);
}
-static int iax2_digit_end(struct ast_channel *c, char digit)
+static int iax2_digit_end(struct ast_channel *c, char digit, unsigned int duration)
{
return send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_DTMF_END, digit, 0, NULL, 0, -1);
}
diff --git a/channels/chan_local.c b/channels/chan_local.c
index e4c7612cf..4f4b75c5f 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -68,7 +68,7 @@ static const char tdesc[] = "Local Proxy Channel Driver";
static struct ast_channel *local_request(const char *type, int format, void *data, int *cause);
static int local_digit_begin(struct ast_channel *ast, char digit);
-static int local_digit_end(struct ast_channel *ast, char digit);
+static int local_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
static int local_call(struct ast_channel *ast, char *dest, int timeout);
static int local_hangup(struct ast_channel *ast);
static int local_answer(struct ast_channel *ast);
@@ -368,7 +368,7 @@ static int local_digit_begin(struct ast_channel *ast, char digit)
return res;
}
-static int local_digit_end(struct ast_channel *ast, char digit)
+static int local_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
struct local_pvt *p = ast->tech_pvt;
int res = -1;
@@ -381,6 +381,7 @@ static int local_digit_end(struct ast_channel *ast, char digit)
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
f.subclass = digit;
+ f.len = duration;
res = local_queue_frame(p, isoutbound, &f, ast);
ast_mutex_unlock(&p->lock);
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index ff6087156..78d1948f0 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -428,7 +428,7 @@ static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame);
static int mgcp_indicate(struct ast_channel *ast, int ind, const void *data, size_t datalen);
static int mgcp_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static int mgcp_senddigit_begin(struct ast_channel *ast, char digit);
-static int mgcp_senddigit_end(struct ast_channel *ast, char digit);
+static int mgcp_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
static int mgcp_devicestate(void *data);
static const struct ast_channel_tech mgcp_tech = {
@@ -1276,7 +1276,7 @@ static int mgcp_senddigit_begin(struct ast_channel *ast, char digit)
return -1;
}
-static int mgcp_senddigit_end(struct ast_channel *ast, char digit)
+static int mgcp_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
struct mgcp_subchannel *sub = ast->tech_pvt;
char tmp[4];
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 20a70590f..28cf4e9cb 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -2068,7 +2068,7 @@ static int misdn_digit_begin(struct ast_channel *chan, char digit)
return 0;
}
-static int misdn_digit_end(struct ast_channel *ast, char digit )
+static int misdn_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
struct chan_list *p;
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 4971321aa..06a287957 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -408,7 +408,7 @@ static int setformat(struct chan_oss_pvt *o, int mode);
static struct ast_channel *oss_request(const char *type, int format, void *data
, int *cause);
static int oss_digit_begin(struct ast_channel *c, char digit);
-static int oss_digit_end(struct ast_channel *c, char digit);
+static int oss_digit_end(struct ast_channel *c, char digit, unsigned int duration);
static int oss_text(struct ast_channel *c, const char *text);
static int oss_hangup(struct ast_channel *c);
static int oss_answer(struct ast_channel *c);
@@ -769,10 +769,11 @@ static int oss_digit_begin(struct ast_channel *c, char digit)
return 0;
}
-static int oss_digit_end(struct ast_channel *c, char digit)
+static int oss_digit_end(struct ast_channel *c, char digit, unsigned int duration)
{
/* no better use for received digits than print them */
- ast_verbose(" << Console Received digit %c >> \n", digit);
+ ast_verbose(" << Console Received digit %c of duration %u ms >> \n",
+ digit, duration);
return 0;
}
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 73113d57e..44d79c25a 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -159,7 +159,7 @@ static char cid_name[AST_MAX_EXTENSION];
static struct ast_channel *phone_request(const char *type, int format, void *data, int *cause);
static int phone_digit_begin(struct ast_channel *ast, char digit);
-static int phone_digit_end(struct ast_channel *ast, char digit);
+static int phone_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
static int phone_call(struct ast_channel *ast, char *dest, int timeout);
static int phone_hangup(struct ast_channel *ast);
static int phone_answer(struct ast_channel *ast);
@@ -246,12 +246,12 @@ static int phone_digit_begin(struct ast_channel *chan, char digit)
return 0;
}
-static int phone_digit_end(struct ast_channel *ast, char digit)
+static int phone_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
struct phone_pvt *p;
int outdigit;
p = ast->tech_pvt;
- ast_log(LOG_NOTICE, "Dialed %c\n", digit);
+ ast_log(LOG_DEBUG, "Dialed %c\n", digit);
switch(digit) {
case '0':
case '1':
@@ -282,7 +282,7 @@ static int phone_digit_end(struct ast_channel *ast, char digit)
ast_log(LOG_WARNING, "Unknown digit '%c'\n", digit);
return -1;
}
- ast_log(LOG_NOTICE, "Dialed %d\n", outdigit);
+ ast_log(LOG_DEBUG, "Dialed %d\n", outdigit);
ioctl(p->fd, PHONE_PLAY_TONE, outdigit);
p->lastformat = -1;
return 0;
@@ -335,7 +335,7 @@ static int phone_call(struct ast_channel *ast, char *dest, int timeout)
{
digit++;
while (*digit)
- phone_digit_end(ast, *digit++);
+ phone_digit_end(ast, *digit++, 0);
}
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index d767ebe8f..a313c8dc5 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1207,7 +1207,7 @@ static int sip_indicate(struct ast_channel *ast, int condition, const void *data
static int sip_transfer(struct ast_channel *ast, const char *dest);
static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static int sip_senddigit_begin(struct ast_channel *ast, char digit);
-static int sip_senddigit_end(struct ast_channel *ast, char digit);
+static int sip_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
/*--- Transmitting responses and requests */
static int sipsock_read(int *id, int fd, short events, void *ignore);
@@ -1229,7 +1229,7 @@ static int transmit_request(struct sip_pvt *p, int sipmethod, int inc, enum xmit
static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch);
static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init);
static int transmit_reinvite_with_sdp(struct sip_pvt *p);
-static int transmit_info_with_digit(struct sip_pvt *p, const char digit);
+static int transmit_info_with_digit(struct sip_pvt *p, const char digit, unsigned int duration);
static int transmit_info_with_vidupdate(struct sip_pvt *p);
static int transmit_message_with_text(struct sip_pvt *p, const char *text);
static int transmit_refer(struct sip_pvt *p, const char *dest);
@@ -1481,7 +1481,7 @@ static int add_header(struct sip_request *req, const char *var, const char *valu
static int add_header_contentLength(struct sip_request *req, int len);
static int add_line(struct sip_request *req, const char *line);
static int add_text(struct sip_request *req, const char *text);
-static int add_digit(struct sip_request *req, char digit);
+static int add_digit(struct sip_request *req, char digit, unsigned int duration);
static int add_vidupdate(struct sip_request *req);
static void add_route(struct sip_request *req, struct sip_route *route);
static int copy_header(struct sip_request *req, const struct sip_request *orig, const char *field);
@@ -1550,6 +1550,30 @@ static const struct ast_channel_tech sip_tech = {
.send_text = sip_sendtext,
};
+/*! \brief This version of the sip channel tech has no send_digit_begin
+ * callback. This is for use with channels using SIP INFO DTMF so that
+ * the core knows that the channel doesn't want DTMF BEGIN frames. */
+static const struct ast_channel_tech sip_tech_info = {
+ .type = "SIP",
+ .description = "Session Initiation Protocol (SIP)",
+ .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
+ .properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
+ .requester = sip_request_call,
+ .devicestate = sip_devicestate,
+ .call = sip_call,
+ .hangup = sip_hangup,
+ .answer = sip_answer,
+ .read = sip_read,
+ .write = sip_write,
+ .write_video = sip_write,
+ .indicate = sip_indicate,
+ .transfer = sip_transfer,
+ .fixup = sip_fixup,
+ .send_digit_end = sip_senddigit_end,
+ .bridge = ast_rtp_bridge,
+ .send_text = sip_sendtext,
+};
+
/**--- some list management macros. **/
#define UNLINK(element, head, prev) do { \
@@ -3574,7 +3598,7 @@ static int sip_senddigit_begin(struct ast_channel *ast, char digit)
/*! \brief Send DTMF character on SIP channel
within one call, we're able to transmit in many methods simultaneously */
-static int sip_senddigit_end(struct ast_channel *ast, char digit)
+static int sip_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
struct sip_pvt *p = ast->tech_pvt;
int res = 0;
@@ -3582,7 +3606,7 @@ static int sip_senddigit_end(struct ast_channel *ast, char digit)
ast_mutex_lock(&p->lock);
switch (ast_test_flag(&p->flags[0], SIP_DTMF)) {
case SIP_DTMF_INFO:
- transmit_info_with_digit(p, digit);
+ transmit_info_with_digit(p, digit, duration);
break;
case SIP_DTMF_RFC2833:
if (p->rtp)
@@ -3742,7 +3766,11 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
return NULL;
}
ast_mutex_lock(&i->lock);
- tmp->tech = &sip_tech;
+
+ if (ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INFO)
+ tmp->tech = &sip_tech_info;
+ else
+ tmp->tech = &sip_tech;
/* Select our native format based on codec preference until we receive
something from another device to the contrary. */
@@ -5821,11 +5849,11 @@ static int add_text(struct sip_request *req, const char *text)
/*! \brief Add DTMF INFO tone to sip message */
/* Always adds default duration 250 ms, regardless of what came in over the line */
-static int add_digit(struct sip_request *req, char digit)
+static int add_digit(struct sip_request *req, char digit, unsigned int duration)
{
char tmp[256];
- snprintf(tmp, sizeof(tmp), "Signal=%c\r\nDuration=250\r\n", digit);
+ snprintf(tmp, sizeof(tmp), "Signal=%c\r\nDuration=%u\r\n", digit, duration);
add_header(req, "Content-Type", "application/dtmf-relay");
add_header_contentLength(req, strlen(tmp));
add_line(req, tmp);
@@ -7389,12 +7417,12 @@ static int transmit_refer(struct sip_pvt *p, const char *dest)
/*! \brief Send SIP INFO dtmf message, see Cisco documentation on cisco.com */
-static int transmit_info_with_digit(struct sip_pvt *p, const char digit)
+static int transmit_info_with_digit(struct sip_pvt *p, const char digit, unsigned int duration)
{
struct sip_request req;
reqprep(&req, p, SIP_INFO, 0, 1);
- add_digit(&req, digit);
+ add_digit(&req, digit, duration);
return send_request(p, &req, XMIT_RELIABLE, p->ocseq);
}
@@ -10655,6 +10683,7 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
/* Need to check the media/type */
if (!strcasecmp(c, "application/dtmf-relay") ||
!strcasecmp(c, "application/vnd.nortelnetworks.digits")) {
+ unsigned int duration = 0;
/* Try getting the "signal=" part */
if (ast_strlen_zero(c = get_body(req, "Signal")) && ast_strlen_zero(c = get_body(req, "d"))) {
@@ -10664,7 +10693,12 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
} else {
ast_copy_string(buf, c, sizeof(buf));
}
-
+
+ if (!ast_strlen_zero((c = get_body(req, "Duration"))))
+ duration = atoi(c);
+ if (!duration)
+ duration = 100; /* 100 ms */
+
if (!p->owner) { /* not a PBX call */
transmit_response(p, "481 Call leg/transaction does not exist", req);
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
@@ -10702,6 +10736,7 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
} else if (event < 16) {
f.subclass = 'A' + (event - 12);
}
+ f.len = duration;
ast_queue_frame(p->owner, &f);
if (sipdebug)
ast_verbose("* DTMF-relay event received: %c\n", f.subclass);
@@ -11230,7 +11265,7 @@ static int func_header_read(struct ast_channel *chan, char *function, char *data
}
ast_channel_lock(chan);
- if (chan->tech != &sip_tech) {
+ if (chan->tech != &sip_tech && chan->tech != &sip_tech_info) {
ast_log(LOG_WARNING, "This function can only be used on SIP channels.\n");
ast_channel_unlock(chan);
return -1;
@@ -11405,7 +11440,7 @@ static int function_sipchaninfo_read(struct ast_channel *chan, char *cmd, char *
}
ast_channel_lock(chan);
- if (chan->tech != &sip_tech) {
+ if (chan->tech != &sip_tech && chan->tech != &sip_tech_info) {
ast_log(LOG_WARNING, "This function can only be used on SIP channels.\n");
ast_channel_unlock(chan);
return -1;
@@ -11653,7 +11688,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru
ast_log(LOG_WARNING, "Ooooh.. no tech! That's REALLY bad\n");
break;
}
- if (bridgepeer->tech == &sip_tech) {
+ if (bridgepeer->tech == &sip_tech || bridgepeer->tech == &sip_tech_info) {
bridgepvt = (struct sip_pvt*)(bridgepeer->tech_pvt);
if (bridgepvt->udptl) {
if (p->t38.state == T38_PEER_REINVITE) {
@@ -13446,7 +13481,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
if ((bridgepeer = ast_bridged_channel(p->owner))) {
/* We have a bridge, and this is re-invite to switchover to T38 so we send re-invite with T38 SDP, to other side of bridge*/
/*! XXX: we should also check here does the other side supports t38 at all !!! XXX */
- if (bridgepeer->tech == &sip_tech) {
+ if (bridgepeer->tech == &sip_tech || bridgepeer->tech == &sip_tech_info) {
bridgepvt = (struct sip_pvt*)bridgepeer->tech_pvt;
if (bridgepvt->t38.state == T38_DISABLED) {
if (bridgepvt->udptl) { /* If everything is OK with other side's udptl struct */
@@ -13500,7 +13535,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
struct ast_channel *bridgepeer = NULL;
struct sip_pvt *bridgepvt = NULL;
if ((bridgepeer = ast_bridged_channel(p->owner))) {
- if (bridgepeer->tech == &sip_tech) {
+ if (bridgepeer->tech == &sip_tech || bridgepeer->tech == &sip_tech_info) {
bridgepvt = (struct sip_pvt*)bridgepeer->tech_pvt;
/* Does the bridged peer have T38 ? */
if (bridgepvt->t38.state == T38_ENABLED) {
@@ -16781,7 +16816,7 @@ static int sip_dtmfmode(struct ast_channel *chan, void *data)
return 0;
}
ast_channel_lock(chan);
- if (chan->tech != &sip_tech) {
+ if (chan->tech != &sip_tech && chan->tech != &sip_tech_info) {
ast_log(LOG_WARNING, "Call this application only on SIP incoming calls\n");
ast_channel_unlock(chan);
return 0;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 0552a5c84..9b8faf55e 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -1032,7 +1032,7 @@ static int skinny_write(struct ast_channel *ast, struct ast_frame *frame);
static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, size_t datalen);
static int skinny_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static int skinny_senddigit_begin(struct ast_channel *ast, char digit);
-static int skinny_senddigit_end(struct ast_channel *ast, char digit);
+static int skinny_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
static const struct ast_channel_tech skinny_tech = {
.type = "Skinny",
@@ -2566,7 +2566,7 @@ static int skinny_senddigit_begin(struct ast_channel *ast, char digit)
return -1; /* Start inband indications */
}
-static int skinny_senddigit_end(struct ast_channel *ast, char digit)
+static int skinny_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration)
{
#if 0
struct skinny_subchannel *sub = ast->tech_pvt;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 4d1935202..bbec9c182 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -673,7 +673,7 @@ static struct zt_chan_conf zt_chan_conf_default(void) {
static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause);
static int zt_digit_begin(struct ast_channel *ast, char digit);
-static int zt_digit_end(struct ast_channel *ast, char digit);
+static int zt_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
static int zt_sendtext(struct ast_channel *c, const char *text);
static int zt_call(struct ast_channel *ast, char *rdest, int timeout);
static int zt_hangup(struct ast_channel *ast);
@@ -1059,7 +1059,7 @@ out:
return 0;
}
-static int zt_digit_end(struct ast_channel *chan, char digit)
+static int zt_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
{
struct zt_pvt *pvt;
int res = 0;