Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.827 diff -u -r1.827 chan_sip.c --- channels/chan_sip.c 30 Aug 2005 02:12:09 -0000 1.827 +++ channels/chan_sip.c 30 Aug 2005 10:42:45 -0000 @@ -1227,6 +1227,13 @@ p->autokillid = -1; ast_log(LOG_DEBUG, "Auto destroying call '%s'\n", p->callid); append_history(p, "AutoDestroy", ""); + + /* If this is a subscription, tell the phone that we got a timeout */ + if (p->subscribed) { + p->subscribed = TIMEOUT; + transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, 1); /* Send first notification */ + } + if (p->owner) { ast_log(LOG_WARNING, "Autodestruct on call '%s' with owner in place\n", p->callid); ast_queue_hangup(p->owner); @@ -1247,11 +1254,6 @@ append_history(p, "SchedDestroy", tmp); } - /* If this is a subscription, tell the phone that we got a timeout */ - if (p->subscribed) { - p->subscribed = TIMEOUT; - transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, 1); /* Send first notification */ - } if (p->autokillid > -1) ast_sched_del(sched, p->autokillid); p->autokillid = ast_sched_add(sched, ms, __sip_autodestruct, p); @@ -1506,16 +1508,16 @@ } /*--- realtime_update_peer: Update peer object in realtime storage ---*/ -static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, int expirey) +static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, int expiry) { char port[10] = ""; char ipaddr[20] = ""; char regseconds[20] = "0"; - if (expirey) { /* Registration */ + if (expiry) { /* Registration */ time_t nowtime; time(&nowtime); - nowtime += expirey; + nowtime += expiry; snprintf(regseconds, sizeof(regseconds), "%ld", nowtime); /* Expiration time */ ast_inet_ntoa(ipaddr, sizeof(ipaddr), sin->sin_addr); snprintf(port, sizeof(port), "%d", ntohs(sin->sin_port)); @@ -7981,7 +7983,7 @@ if (!strncasecmp(cur->callid, argv[3],len)) { ast_cli(fd,"\n"); if (cur->subscribed != NONE) - ast_cli(fd, " * Subscription\n"); + ast_cli(fd, " * Subscription (%s)\n", subscription_type2str(cur->subscribed)); else ast_cli(fd, " * SIP Call\n"); ast_cli(fd, " Direction: %s\n", ast_test_flag(cur, SIP_OUTGOING)?"Outgoing":"Incoming"); Index: configs/sip.conf.sample =================================================================== RCS file: /usr/cvsroot/asterisk/configs/sip.conf.sample,v retrieving revision 1.66 diff -u -r1.66 sip.conf.sample --- configs/sip.conf.sample 25 Aug 2005 02:25:30 -0000 1.66 +++ configs/sip.conf.sample 30 Aug 2005 10:42:45 -0000 @@ -48,6 +48,9 @@ ;maxexpirey=3600 ; Max length of incoming registration we allow ;defaultexpirey=120 ; Default length of incoming/outoing registration ;notifymimetype=text/plain ; Allow overriding of mime type in MWI NOTIFY +;notifyringing=no ; Sent ringing (yes) or inuse (no) as state in + ; NOTIFY messages when observed extension is + ; in state RINGING_AND_INUSE (defaults to "yes") ;checkmwi=10 ; Default time between mailbox checks for peers ;vmexten=voicemail ; dialplan extension to reach mailbox sets the ; Message-Account in the MWI notify message @@ -213,6 +216,7 @@ ; User config options: Peer configuration: ; -------------------- ------------------- ; context context +; subscribecontext subscribecontext ; permit permit ; deny deny ; secret secret @@ -232,10 +236,10 @@ ; useclientcode useclientcode ; accountcode accountcode ; setvar setvar -; callerid callerid -; amaflags amaflags -; incominglimit incominglimit -; restrictcid restrictcid +; callerid callerid +; amaflags amaflags +; incominglimit incominglimit +; restrictcid restrictcid ; mailbox ; username ; template @@ -319,6 +323,7 @@ ;[snom] ;type=friend ; Friends place calls and receive calls ;context=from-sip ; Context for incoming calls from this user +;subscribecontext=mygroup ; context for subscriptions (hints) ;secret=blah ;language=de ; Use German prompts for this user ;host=dynamic ; This peer register with us Index: include/asterisk/pbx.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/pbx.h,v retrieving revision 1.51 diff -u -r1.51 pbx.h --- include/asterisk/pbx.h 29 Aug 2005 23:53:29 -0000 1.51 +++ include/asterisk/pbx.h 30 Aug 2005 10:42:46 -0000 @@ -35,22 +35,14 @@ /*! Extension states */ enum ast_extension_states { - /*! Extension removed */ - AST_EXTENSION_REMOVED = -2, - /*! Extension hint removed */ - AST_EXTENSION_DEACTIVATED = -1, - /*! No device INUSE or BUSY */ - AST_EXTENSION_NOT_INUSE = 0, - /*! One or more devices INUSE */ - AST_EXTENSION_INUSE = 1 << 0, - /*! All devices BUSY */ - AST_EXTENSION_BUSY = 1 << 1, - /*! All devices UNAVAILABLE/UNREGISTERED */ - AST_EXTENSION_UNAVAILABLE = 1 << 2, - /*! All devices RINGING */ - AST_EXTENSION_RINGING = 1 << 3, + AST_EXTENSION_REMOVED = -2, /*! Extension removed */ + AST_EXTENSION_DEACTIVATED = -1, /*! Extension hint removed */ + AST_EXTENSION_NOT_INUSE = 0, /*! No device INUSE or BUSY */ + AST_EXTENSION_INUSE = 1 << 0, /*! One or more devices INUSE */ + AST_EXTENSION_BUSY = 1 << 1, /*! All devices BUSY */ + AST_EXTENSION_UNAVAILABLE = 1 << 2, /*! All devices UNAVAILABLE/UNREGISTERED */ + AST_EXTENSION_RINGING = 1 << 3, /*! All devices RINGING */ }; - static const struct cfextension_states { int extension_state;