mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 11:28:25 +00:00
- Remove debug variable that was only used in one place
- convert string handling to the ast_str API - Convert strdup() to ast_strdup() and check the result - Minor formatting changes git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2546,15 +2546,19 @@ static int parse_uri(char *uri, char *scheme,
|
|||||||
static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data, int datalen)
|
static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data, int datalen)
|
||||||
{
|
{
|
||||||
struct sip_pvt *p = chan->tech_pvt;
|
struct sip_pvt *p = chan->tech_pvt;
|
||||||
char *tmp;
|
struct ast_str *buf;
|
||||||
int debug = sip_debug_test_pvt(p);
|
|
||||||
if (subclass != AST_HTML_URL)
|
if (subclass != AST_HTML_URL)
|
||||||
return -1;
|
return -1;
|
||||||
tmp = alloca(strlen(data) + 20);
|
|
||||||
snprintf(tmp, strlen(data) + 20, "<%s>;mode=active", data);
|
buf = ast_str_alloca(64);
|
||||||
p->url = tmp;
|
|
||||||
if (debug)
|
ast_str_set(&buf, 0, "<%s>;mode=active", data);
|
||||||
ast_verbose("Send URL %s, state = %d!\n", data, chan->_state);
|
p->url = buf->str;
|
||||||
|
|
||||||
|
if (sip_debug_test_pvt(p) && option_debug)
|
||||||
|
ast_log(LOG_DEBUG, "Send URL %s, state = %d!\n", data, chan->_state);
|
||||||
|
|
||||||
switch (chan->_state) {
|
switch (chan->_state) {
|
||||||
case AST_STATE_RING:
|
case AST_STATE_RING:
|
||||||
transmit_response(p, "100 Trying", &p->initreq);
|
transmit_response(p, "100 Trying", &p->initreq);
|
||||||
@@ -2568,15 +2572,17 @@ static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data
|
|||||||
} else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
|
} else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
|
||||||
/* We have a pending Invite. Send re-invite when we're done with the invite */
|
/* We have a pending Invite. Send re-invite when we're done with the invite */
|
||||||
ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
|
ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
|
||||||
p->url = strdup(p->url);
|
if ((p->url = ast_strdup(p->url)))
|
||||||
p->freeurl = 1;
|
p->freeurl = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ast_log(LOG_WARNING, "Don't know how to send URI when state is %d!\n", chan->_state);
|
ast_log(LOG_WARNING, "Don't know how to send URI when state is %d!\n", chan->_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->url && !p->freeurl)
|
if (p->url && !p->freeurl)
|
||||||
ast_log(LOG_WARNING, "Whoa, didn't expect URI to hang around!\n");
|
ast_log(LOG_WARNING, "Whoa, didn't expect URI to hang around!\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user