Remove lastmsgssent from sip it has not been working since 1.6


			
			
				certified/11.2
			
			
		
Gregory Nietsky 14 years ago
parent c0f592df46
commit 5c627eba2b

@ -14593,19 +14593,16 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
case PARSE_REGISTER_DENIED: case PARSE_REGISTER_DENIED:
ast_log(LOG_WARNING, "Registration denied because of contact ACL\n"); ast_log(LOG_WARNING, "Registration denied because of contact ACL\n");
transmit_response_with_date(p, "603 Denied", req); transmit_response_with_date(p, "603 Denied", req);
peer->lastmsgssent = -1;
res = 0; res = 0;
break; break;
case PARSE_REGISTER_FAILED: case PARSE_REGISTER_FAILED:
ast_log(LOG_WARNING, "Failed to parse contact info\n"); ast_log(LOG_WARNING, "Failed to parse contact info\n");
transmit_response_with_date(p, "400 Bad Request", req); transmit_response_with_date(p, "400 Bad Request", req);
peer->lastmsgssent = -1;
res = 0; res = 0;
break; break;
case PARSE_REGISTER_QUERY: case PARSE_REGISTER_QUERY:
ast_string_field_set(p, fullcontact, peer->fullcontact); ast_string_field_set(p, fullcontact, peer->fullcontact);
transmit_response_with_date(p, "200 OK", req); transmit_response_with_date(p, "200 OK", req);
peer->lastmsgssent = -1;
res = 0; res = 0;
break; break;
case PARSE_REGISTER_UPDATE: case PARSE_REGISTER_UPDATE:
@ -14613,8 +14610,6 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
update_peer(peer, p->expiry); update_peer(peer, p->expiry);
/* Say OK and ask subsystem to retransmit msg counter */ /* Say OK and ask subsystem to retransmit msg counter */
transmit_response_with_date(p, "200 OK", req); transmit_response_with_date(p, "200 OK", req);
if (!ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY))
peer->lastmsgssent = -1;
res = 0; res = 0;
break; break;
} }
@ -14639,19 +14634,16 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
case PARSE_REGISTER_DENIED: case PARSE_REGISTER_DENIED:
ast_log(LOG_WARNING, "Registration denied because of contact ACL\n"); ast_log(LOG_WARNING, "Registration denied because of contact ACL\n");
transmit_response_with_date(p, "403 Forbidden (ACL)", req); transmit_response_with_date(p, "403 Forbidden (ACL)", req);
peer->lastmsgssent = -1;
res = 0; res = 0;
break; break;
case PARSE_REGISTER_FAILED: case PARSE_REGISTER_FAILED:
ast_log(LOG_WARNING, "Failed to parse contact info\n"); ast_log(LOG_WARNING, "Failed to parse contact info\n");
transmit_response_with_date(p, "400 Bad Request", req); transmit_response_with_date(p, "400 Bad Request", req);
peer->lastmsgssent = -1;
res = 0; res = 0;
break; break;
case PARSE_REGISTER_QUERY: case PARSE_REGISTER_QUERY:
ast_string_field_set(p, fullcontact, peer->fullcontact); ast_string_field_set(p, fullcontact, peer->fullcontact);
transmit_response_with_date(p, "200 OK", req); transmit_response_with_date(p, "200 OK", req);
peer->lastmsgssent = -1;
res = 0; res = 0;
break; break;
case PARSE_REGISTER_UPDATE: case PARSE_REGISTER_UPDATE:
@ -14659,7 +14651,6 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
/* Say OK and ask subsystem to retransmit msg counter */ /* Say OK and ask subsystem to retransmit msg counter */
transmit_response_with_date(p, "200 OK", req); 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)); 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; res = 0;
break; break;
} }
@ -14675,6 +14666,7 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
sched_yield(); sched_yield();
} }
if (!res) { if (!res) {
sip_send_mwi_to_peer(peer, NULL, 0);
ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", peer->name); ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", peer->name);
} }
if (res < 0) { if (res < 0) {
@ -17337,7 +17329,6 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct
ast_cli(fd, " MOH Suggest : %s\n", peer->mohsuggest); ast_cli(fd, " MOH Suggest : %s\n", peer->mohsuggest);
ast_cli(fd, " Mailbox : %s\n", mailbox_str->str); ast_cli(fd, " Mailbox : %s\n", mailbox_str->str);
ast_cli(fd, " VM Extension : %s\n", peer->vmexten); ast_cli(fd, " VM Extension : %s\n", peer->vmexten);
ast_cli(fd, " LastMsgsSent : %d/%d\n", (peer->lastmsgssent & 0x7fff0000) >> 16, peer->lastmsgssent & 0xffff);
ast_cli(fd, " Call limit : %d\n", peer->call_limit); ast_cli(fd, " Call limit : %d\n", peer->call_limit);
ast_cli(fd, " Max forwards : %d\n", peer->maxforwards); ast_cli(fd, " Max forwards : %d\n", peer->maxforwards);
if (peer->busy_level) if (peer->busy_level)
@ -17452,7 +17443,6 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct
astman_append(s, "VoiceMailbox: %s\r\n", mailbox_str->str); astman_append(s, "VoiceMailbox: %s\r\n", mailbox_str->str);
astman_append(s, "TransferMode: %s\r\n", transfermode2str(peer->allowtransfer)); astman_append(s, "TransferMode: %s\r\n", transfermode2str(peer->allowtransfer));
astman_append(s, "Maxforwards: %d\r\n", peer->maxforwards); astman_append(s, "Maxforwards: %d\r\n", peer->maxforwards);
astman_append(s, "LastMsgsSent: %d\r\n", peer->lastmsgssent);
astman_append(s, "Maxforwards: %d\r\n", peer->maxforwards); astman_append(s, "Maxforwards: %d\r\n", peer->maxforwards);
astman_append(s, "Call-limit: %d\r\n", peer->call_limit); astman_append(s, "Call-limit: %d\r\n", peer->call_limit);
astman_append(s, "Busy-level: %d\r\n", peer->busy_level); astman_append(s, "Busy-level: %d\r\n", peer->busy_level);
@ -25527,19 +25517,23 @@ static int get_cached_mwi(struct sip_peer *peer, int *new, int *old)
return in_cache; return in_cache;
} }
/*! \brief Send message waiting indication to alert peer that they've got voicemail */ /*! \brief Send message waiting indication to alert peer that they've got voicemail
* \returns -1 on failure, 0 on success
*/
static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *event, int cache_only) static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *event, int cache_only)
{ {
/* Called with peerl lock, but releases it */ /* Called with peerl lock, but releases it */
struct sip_pvt *p; struct sip_pvt *p;
int newmsgs = 0, oldmsgs = 0; int newmsgs = 0, oldmsgs = 0;
if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt) if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt) {
return 0; return -1;
}
/* Do we have an IP address? If not, skip this peer */ /* Do we have an IP address? If not, skip this peer */
if (ast_sockaddr_isnull(&peer->addr) && ast_sockaddr_isnull(&peer->defaddr)) if (ast_sockaddr_isnull(&peer->addr) && ast_sockaddr_isnull(&peer->defaddr)) {
return 0; return -1;
}
if (event) { if (event) {
newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS); newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
@ -25548,6 +25542,10 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *e
/* Fall back to manually checking the mailbox */ /* Fall back to manually checking the mailbox */
struct ast_str *mailbox_str = ast_str_alloca(512); struct ast_str *mailbox_str = ast_str_alloca(512);
peer_mailboxes_to_str(&mailbox_str, peer); 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); ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
} }
@ -25568,7 +25566,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *e
dialog_unlink_all(p, TRUE, TRUE); dialog_unlink_all(p, TRUE, TRUE);
dialog_unref(p, "unref dialog p just created via sip_alloc"); dialog_unref(p, "unref dialog p just created via sip_alloc");
/* sip_destroy(p); */ /* sip_destroy(p); */
return 0; return -1;
} }
/* Recalculate our side, and recalculate Call ID */ /* Recalculate our side, and recalculate Call ID */
ast_sip_ouraddrfor(&p->sa, &p->ourip, p); ast_sip_ouraddrfor(&p->sa, &p->ourip, p);
@ -27147,7 +27145,6 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
/* Note that our peer HAS had its reference count increased */ /* Note that our peer HAS had its reference count increased */
if (firstpass) { if (firstpass) {
peer->lastmsgssent = -1;
oldha = peer->ha; oldha = peer->ha;
peer->ha = NULL; peer->ha = NULL;
olddirectmediaha = peer->directmediaha; olddirectmediaha = peer->directmediaha;

@ -1226,7 +1226,6 @@ struct sip_peer {
int maxforwards; /*!< SIP Loop prevention */ int maxforwards; /*!< SIP Loop prevention */
enum transfermodes allowtransfer; /*! SIP Refer restriction scheme */ enum transfermodes allowtransfer; /*! SIP Refer restriction scheme */
struct ast_codec_pref prefs; /*!< codec prefs */ struct ast_codec_pref prefs; /*!< codec prefs */
int lastmsgssent;
unsigned int sipoptions; /*!< Supported SIP options */ unsigned int sipoptions; /*!< Supported SIP options */
struct ast_flags flags[3]; /*!< SIP_ flags */ struct ast_flags flags[3]; /*!< SIP_ flags */

Loading…
Cancel
Save