mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
State change patch
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@740 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
pbx.c
13
pbx.c
@@ -1245,18 +1245,21 @@ int ast_extension_state_add(char *context, char *exten,
|
|||||||
struct ast_notify_cb *cblist;
|
struct ast_notify_cb *cblist;
|
||||||
struct ast_exten *e;
|
struct ast_exten *e;
|
||||||
|
|
||||||
|
e = ast_hint_extension(NULL, context, exten);
|
||||||
|
if (!e) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(¬ifylock);
|
pthread_mutex_lock(¬ifylock);
|
||||||
list = notifys;
|
list = notifys;
|
||||||
|
|
||||||
while (list) {
|
while (list) {
|
||||||
if (!strcmp(list->exten->parent->name, context) &&
|
if (list->exten == e)
|
||||||
!strcmp(list->exten->exten, exten))
|
|
||||||
break;
|
break;
|
||||||
list = list->next;
|
list = list->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!list) {
|
if (!list) {
|
||||||
e = ast_hint_extension(NULL, context, exten);
|
|
||||||
if (!e) {
|
if (!e) {
|
||||||
pthread_mutex_unlock(¬ifylock);
|
pthread_mutex_unlock(¬ifylock);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1267,9 +1270,9 @@ int ast_extension_state_add(char *context, char *exten,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Initialize and insert new item */
|
/* Initialize and insert new item */
|
||||||
memset(list, 0, sizeof(struct ast_notify));
|
memset(list, 0, sizeof(struct ast_notify));
|
||||||
list->exten = e;
|
list->exten = e;
|
||||||
list->laststate = -1;
|
list->laststate = ast_extension_state2(e);
|
||||||
list->next = notifys;
|
list->next = notifys;
|
||||||
notifys = list;
|
notifys = list;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user