diff options
author | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-08-09 14:12:34 +0000 |
---|---|---|
committer | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-08-09 14:12:34 +0000 |
commit | 3d55cb9df3d68aaf7b6c118a35eefca66a89f93d (patch) | |
tree | 6a534688d20b619eff7cbecfceab273c3ad9eb69 /channels/chan_mgcp.c | |
parent | 428ca971316dc60a0ea0413851d8438b4896dfee (diff) |
More RSW merges. This should do it for the channels/ dir.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@136917 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r-- | channels/chan_mgcp.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 21d1a9ad4..a5c54d4b9 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -153,10 +153,12 @@ static int nat = 0; static ast_group_t cur_callergroup = 0; static ast_group_t cur_pickupgroup = 0; -static unsigned int tos = 0; -static unsigned int tos_audio = 0; -static unsigned int cos = 0; -static unsigned int cos_audio = 0; +static struct { + unsigned int tos; + unsigned int tos_audio; + unsigned int cos; + unsigned int cos_audio; +} qos = { 0, 0, 0, 0 }; static int immediate = 0; @@ -460,16 +462,16 @@ static int has_voicemail(struct mgcp_endpoint *p) { int new_msgs; struct ast_event *event; - char *mailbox, *context; + char *mbox, *cntx; - context = mailbox = ast_strdupa(p->mailbox); - strsep(&context, "@"); - if (ast_strlen_zero(context)) - context = "default"; + cntx = mbox = ast_strdupa(p->mailbox); + strsep(&cntx, "@"); + if (ast_strlen_zero(cntx)) + cntx = "default"; event = ast_event_get_cached(AST_EVENT_MWI, - AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox, - AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context, + AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mbox, + AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, cntx, AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS, AST_EVENT_IE_END); @@ -694,7 +696,7 @@ static int mgcp_postrequest(struct mgcp_endpoint *p, struct mgcp_subchannel *sub struct mgcp_message *msg; struct mgcp_message *cur; struct mgcp_gateway *gw; - struct timeval tv; + struct timeval now; msg = ast_malloc(sizeof(*msg) + len); if (!msg) { @@ -731,8 +733,8 @@ static int mgcp_postrequest(struct mgcp_endpoint *p, struct mgcp_subchannel *sub gw->msgs = msg; } - tv = ast_tvnow(); - msg->expire = tv.tv_sec * 1000 + tv.tv_usec / 1000 + DEFAULT_RETRANS; + now = ast_tvnow(); + msg->expire = now.tv_sec * 1000 + now.tv_usec / 1000 + DEFAULT_RETRANS; if (gw->retransid == -1) gw->retransid = ast_sched_add(sched, DEFAULT_RETRANS, retrans_pkt, (void *)gw); @@ -2644,7 +2646,7 @@ static void start_rtp(struct mgcp_subchannel *sub) if (sub->rtp && sub->owner) ast_channel_set_fd(sub->owner, 0, ast_rtp_fd(sub->rtp)); if (sub->rtp) { - ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "MGCP RTP"); + ast_rtp_setqos(sub->rtp, qos.tos_audio, qos.cos_audio, "MGCP RTP"); ast_rtp_setnat(sub->rtp, sub->nat); } #if 0 @@ -3750,14 +3752,14 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) ast_copy_string(e->mailbox, mailbox, sizeof(e->mailbox)); ast_copy_string(e->parkinglot, parkinglot, sizeof(e->parkinglot)); if (!ast_strlen_zero(e->mailbox)) { - char *mailbox, *context; - context = mailbox = ast_strdupa(e->mailbox); - strsep(&context, "@"); - if (ast_strlen_zero(context)) - context = "default"; + char *mbox, *cntx; + cntx = mbox = ast_strdupa(e->mailbox); + strsep(&cntx, "@"); + if (ast_strlen_zero(cntx)) + cntx = "default"; e->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, NULL, - AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox, - AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context, + AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mbox, + AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, cntx, AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS, AST_EVENT_IE_END); } @@ -4155,16 +4157,16 @@ static int reload_config(int reload) else capability &= ~format; } else if (!strcasecmp(v->name, "tos")) { - if (ast_str2tos(v->value, &tos)) + if (ast_str2tos(v->value, &qos.tos)) ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno); } else if (!strcasecmp(v->name, "tos_audio")) { - if (ast_str2tos(v->value, &tos_audio)) + if (ast_str2tos(v->value, &qos.tos_audio)) ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno); } else if (!strcasecmp(v->name, "cos")) { - if (ast_str2cos(v->value, &cos)) + if (ast_str2cos(v->value, &qos.cos)) ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno); } else if (!strcasecmp(v->name, "cos_audio")) { - if (ast_str2cos(v->value, &cos_audio)) + if (ast_str2cos(v->value, &qos.cos_audio)) ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno); } else if (!strcasecmp(v->name, "port")) { if (sscanf(v->value, "%d", &ourport) == 1) { @@ -4249,7 +4251,7 @@ static int reload_config(int reload) } else { ast_verb(2, "MGCP Listening on %s:%d\n", ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port)); - ast_netsock_set_qos(mgcpsock, tos, cos, "MGCP"); + ast_netsock_set_qos(mgcpsock, qos.tos, qos.cos, "MGCP"); } } ast_mutex_unlock(&netlock); |