{
int res;
char iabuf[INET_ADDRSTRLEN];
+// ast_log(LOG_WARNING, "__sip_xmit from '%s' to '%s'\n", "", ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr));
if (p->nat & SIP_NAT_ROUTE)
res=sendto(sipsock, data, len, 0, (struct sockaddr *)&p->recv, sizeof(struct sockaddr_in));
else
ast_cli(fd, " Mailbox : %s\n", peer->mailbox);
ast_cli(fd, " LastMsgsSent : %d\n", peer->lastmsgssent);
ast_cli(fd, " Dynamic : %s\n", (peer->dynamic?"Yes":"No"));
- ast_cli(fd, " Expire : %d\n", peer->expire);
+ ast_cli(fd, " Expire : %ld seconds\n", ast_sched_when(sched,peer->expire));
ast_cli(fd, " Expiry : %d\n", peer->expiry);
ast_cli(fd, " Insecure : %s\n", (peer->insecure?((peer->insecure == 2)?"Very":"Yes"):"No") );
ast_cli(fd, " Nat : %s\n", nat2str(peer->nat));
*/
extern void ast_sched_dump(struct sched_context *con);
+/*!Returns the number of seconds before an event takes place */
+/*!
+ * \param con Context to use
+ * \param id Id to dump
+ */
+extern long ast_sched_when(struct sched_context *con,int id);
+
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
ast_mutex_unlock(&con->lock);
return x;
}
+
+long ast_sched_when(struct sched_context *con,int id)
+{
+ struct sched *s;
+ long secs;
+ struct timeval now;
+ DEBUG(ast_log(LOG_DEBUG, "ast_sched_when()\n"));
+
+ ast_mutex_lock(&con->lock);
+ s=con->schedq;
+ while (s!=NULL) {
+ if (s->id==id) break;
+ s=s->next;
+ }
+ secs=-1;
+ if (s!=NULL) {
+ if (gettimeofday(&now, NULL)) {
+ ast_log(LOG_NOTICE, "gettimeofday() failed!\n");
+ } else {
+ secs=s->when.tv_sec-now.tv_sec;
+ }
+ }
+ ast_mutex_unlock(&con->lock);
+ return secs;
+}