]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
State change patch
authorMark Spencer <markster@digium.com>
Thu, 3 Apr 2003 07:35:14 +0000 (07:35 +0000)
committerMark Spencer <markster@digium.com>
Thu, 3 Apr 2003 07:35:14 +0000 (07:35 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@740 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx.c

diff --git a/pbx.c b/pbx.c
index 9a41ce218388b4b3a1a86dd85a73ce4f114be60b..011bd268777af2422da85eaeac3efd9c4c2543f5 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -1245,18 +1245,21 @@ int ast_extension_state_add(char *context, char *exten,
     struct ast_notify_cb *cblist;
     struct ast_exten *e;
 
+    e = ast_hint_extension(NULL, context, exten);    
+    if (!e) {
+        return -1;
+    }
+    
     pthread_mutex_lock(&notifylock);
     list = notifys;        
     
     while (list) {
-       if (!strcmp(list->exten->parent->name, context) && 
-           !strcmp(list->exten->exten, exten))
+       if (list->exten == e)
            break;          
        list = list->next;    
     }
 
     if (!list) {
-       e = ast_hint_extension(NULL, context, exten);    
        if (!e) {
            pthread_mutex_unlock(&notifylock);
            return -1;
@@ -1267,9 +1270,9 @@ int ast_extension_state_add(char *context, char *exten,
            return -1;
        }
        /* Initialize and insert new item */
-       memset(list, 0, sizeof(struct ast_notify));         
+       memset(list, 0, sizeof(struct ast_notify));
        list->exten = e;
-       list->laststate = -1;
+       list->laststate = ast_extension_state2(e);
        list->next = notifys;
        notifys = list;
     }