[asterisk-commits] irroot: branch irroot/distrotech-customers-trunk r324911 - in /team/irroot/di...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Jun 25 12:45:40 CDT 2011
Author: irroot
Date: Sat Jun 25 12:45:30 2011
New Revision: 324911
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324911
Log:
Changes To the MWI Lastmsgcnt problem to bring it inline with RB: 1272
Move the codec fixup from chan_sip.c to main/channel.c if the frame is a native format set the writeformat this is a
problem in chan_dahdi too
Modified:
team/irroot/distrotech-customers-trunk/channels/chan_sip.c
team/irroot/distrotech-customers-trunk/main/channel.c
Modified: team/irroot/distrotech-customers-trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/channels/chan_sip.c?view=diff&rev=324911&r1=324910&r2=324911
==============================================================================
--- team/irroot/distrotech-customers-trunk/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-trunk/channels/chan_sip.c Sat Jun 25 12:45:30 2011
@@ -4944,7 +4944,6 @@
unref_peer(p, "Wrong type of realtime SIP endpoint");
return NULL;
}
- sip_send_mwi_to_peer(p, NULL, 0);
break;
case FINDALLDEVICES:
break;
@@ -6371,20 +6370,12 @@
switch (frame->frametype) {
case AST_FRAME_VOICE:
if (!(ast_format_cap_iscompatible(ast->nativeformats, &frame->subclass.format))) {
- struct ast_channel *bridge;
char s1[512];
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s read/write = %s/%s\n",
ast_getformatname(&frame->subclass.format),
ast_getformatname_multiple(s1, sizeof(s1), ast->nativeformats),
ast_getformatname(&ast->readformat),
ast_getformatname(&ast->writeformat));
- ast_set_write_format_by_id(ast, frame->subclass.format.id);
- bridge = ast_bridged_channel(ast);
- if (bridge && !ast_channel_trylock(bridge)) {
- ast_log(LOG_WARNING, "Attempting to change formats making %s and %s compat.\n", ast->name, bridge->name);
- ast_channel_make_compatible(ast, bridge);
- ast_channel_unlock(bridge);
- }
return 0;
}
if (p) {
@@ -14622,24 +14613,21 @@
} else {
/* We have a successful registration attempt with proper authentication,
- now, update the peer */
+ now, update the peer */
switch (parse_register_contact(p, peer, req)) {
case PARSE_REGISTER_DENIED:
ast_log(LOG_WARNING, "Registration denied because of contact ACL\n");
transmit_response_with_date(p, "603 Denied", req);
- peer->lastmsgssent = -1;
res = 0;
break;
case PARSE_REGISTER_FAILED:
ast_log(LOG_WARNING, "Failed to parse contact info\n");
transmit_response_with_date(p, "400 Bad Request", req);
- peer->lastmsgssent = -1;
res = 0;
break;
case PARSE_REGISTER_QUERY:
ast_string_field_set(p, fullcontact, peer->fullcontact);
transmit_response_with_date(p, "200 OK", req);
- peer->lastmsgssent = -1;
res = 0;
break;
case PARSE_REGISTER_UPDATE:
@@ -14647,8 +14635,6 @@
update_peer(peer, p->expiry);
/* Say OK and ask subsystem to retransmit msg counter */
transmit_response_with_date(p, "200 OK", req);
- if (!ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY))
- peer->lastmsgssent = -1;
res = 0;
break;
}
@@ -14673,19 +14659,16 @@
case PARSE_REGISTER_DENIED:
ast_log(LOG_WARNING, "Registration denied because of contact ACL\n");
transmit_response_with_date(p, "403 Forbidden (ACL)", req);
- peer->lastmsgssent = -1;
res = 0;
break;
case PARSE_REGISTER_FAILED:
ast_log(LOG_WARNING, "Failed to parse contact info\n");
transmit_response_with_date(p, "400 Bad Request", req);
- peer->lastmsgssent = -1;
res = 0;
break;
case PARSE_REGISTER_QUERY:
ast_string_field_set(p, fullcontact, peer->fullcontact);
transmit_response_with_date(p, "200 OK", req);
- peer->lastmsgssent = -1;
res = 0;
break;
case PARSE_REGISTER_UPDATE:
@@ -14693,7 +14676,6 @@
/* Say OK and ask subsystem to retransmit msg counter */
transmit_response_with_date(p, "200 OK", req);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\n", peer->name, ast_sockaddr_stringify(addr));
- peer->lastmsgssent = -1;
res = 0;
break;
}
@@ -14709,8 +14691,10 @@
sched_yield();
}
if (!res) {
+ if (!sip_send_mwi_to_peer(peer, NULL, 0)) {
+ peer->lastmsgssent = -1;
+ }
ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", peer->name);
- sip_send_mwi_to_peer(peer, NULL, 0);
}
if (res < 0) {
switch (res) {
@@ -25492,12 +25476,14 @@
struct sip_pvt *p;
int newmsgs = 0, oldmsgs = 0;
- if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt)
- return 0;
+ if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt) {
+ return -1;
+ }
/* Do we have an IP address? If not, skip this peer */
- if (ast_sockaddr_isnull(&peer->addr) && ast_sockaddr_isnull(&peer->defaddr))
- return 0;
+ if (ast_sockaddr_isnull(&peer->addr) && ast_sockaddr_isnull(&peer->defaddr)) {
+ return -1;
+ }
if (event) {
newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
@@ -25505,11 +25491,15 @@
} else if (!cache_only) { /* Fall back to manually checking the mailbox */
struct ast_str *mailbox_str = ast_str_alloca(512);
peer_mailboxes_to_str(&mailbox_str, peer);
+ /* if there is no mailbox do nothing */
+ if (ast_strlen_zero(mailbox_str->str)) {
+ return -1;
+ }
ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
} else {
get_cached_mwi(peer, &newmsgs, &oldmsgs);
}
-
+
if (peer->mwipvt) {
/* Base message on subscription */
p = dialog_ref(peer->mwipvt, "sip_send_mwi_to_peer: Setting dialog ptr p from peer->mwipvt-- should this be done?");
@@ -25527,7 +25517,7 @@
dialog_unlink_all(p, TRUE, TRUE);
dialog_unref(p, "unref dialog p just created via sip_alloc");
/* sip_destroy(p); */
- return 0;
+ return -1;
}
/* Recalculate our side, and recalculate Call ID */
ast_sip_ouraddrfor(&p->sa, &p->ourip, p);
Modified: team/irroot/distrotech-customers-trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/main/channel.c?view=diff&rev=324911&r1=324910&r2=324911
==============================================================================
--- team/irroot/distrotech-customers-trunk/main/channel.c (original)
+++ team/irroot/distrotech-customers-trunk/main/channel.c Sat Jun 25 12:45:30 2011
@@ -4931,6 +4931,10 @@
apply_plc(chan, fr);
}
+ if (!(ast_format_cap_iscompatible(chan->nativeformats, &fr->subclass.format))) {
+ ast_set_write_format_by_id(chan, fr->subclass.format.id);
+ }
+
/* If the frame is in the raw write format, then it's easy... just use the frame - otherwise we will have to translate */
if (ast_format_cmp(&fr->subclass.format, &chan->rawwriteformat) != AST_FORMAT_CMP_NOT_EQUAL)
f = fr;
More information about the asterisk-commits
mailing list