aboutsummaryrefslogtreecommitdiffstats
path: root/muted.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-19 03:16:59 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-19 03:16:59 +0000
commit298c4876b4f03783ce86843f9f1f0f750c78e858 (patch)
tree48aef3889cab1999c64a986c29ab93dc9dcf1008 /muted.c
parent764641cee668bbcca0c4fa66f48e71d1201ad198 (diff)
Make muted handle transfers
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3009 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'muted.c')
-rwxr-xr-xmuted.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/muted.c b/muted.c
index 135a4164b..73eb649a6 100755
--- a/muted.c
+++ b/muted.c
@@ -428,6 +428,8 @@ static void append_sub(struct channel *chan, char *name)
static void hangup_chan(char *channel)
{
struct channel *chan;
+ if (debug)
+ printf("Hangup '%s'\n", channel);
chan = find_channel(channel);
if (chan)
delete_sub(chan, channel);
@@ -437,6 +439,8 @@ static void hangup_chan(char *channel)
static void offhook_chan(char *channel)
{
struct channel *chan;
+ if (debug)
+ printf("Offhook '%s'\n", channel);
chan = find_channel(channel);
if (chan)
append_sub(chan, channel);
@@ -446,8 +450,10 @@ static void offhook_chan(char *channel)
static int wait_event(void)
{
char *resp;
- char event[80]="";
- char channel[80]="";
+ char event[120]="";
+ char channel[120]="";
+ char oldname[120]="";
+ char newname[120]="";
resp = get_line();
if (!resp) {
fprintf(stderr, "disconnected (6)\n");
@@ -459,6 +465,10 @@ static int wait_event(void)
while((resp = get_line()) && strlen(resp)) {
if (!strncasecmp(resp, "Channel: ", strlen("Channel: ")))
strncpy(channel, resp + strlen("Channel: "), sizeof(channel));
+ if (!strncasecmp(resp, "Newname: ", strlen("Newname: ")))
+ strncpy(newname, resp + strlen("Newname: "), sizeof(newname));
+ if (!strncasecmp(resp, "Oldname: ", strlen("Oldname: ")))
+ strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname));
}
if (strlen(channel)) {
if (!strcasecmp(event, "Hangup"))
@@ -466,6 +476,12 @@ static int wait_event(void)
else
offhook_chan(channel);
}
+ if (strlen(newname) && strlen(oldname)) {
+ if (!strcasecmp(event, "Rename")) {
+ hangup_chan(oldname);
+ offhook_chan(newname);
+ }
+ }
} else {
/* Consume the rest of the non-event */
while((resp = get_line()) && strlen(resp));