add fixup routine (bug #3825)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@5616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2005-05-10 03:58:26 +00:00
parent 56cf655835
commit 34f9e85a11

View File

@@ -668,6 +668,14 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
return 0;
}
static int phone_fixup(struct ast_channel *old, struct ast_channel *new)
{
struct phone_pvt *pvt = old->pvt->pvt;
if (pvt && pvt->owner == old)
pvt->owner = new;
return 0;
}
static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *context)
{
struct ast_channel *tmp;
@@ -691,6 +699,7 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
tmp->pvt->read = phone_read;
tmp->pvt->write = phone_write;
tmp->pvt->exception = phone_exception;
tmp->pvt->fixup = phone_fixup;
strncpy(tmp->context, context, sizeof(tmp->context)-1);
if (strlen(i->ext))
strncpy(tmp->exten, i->ext, sizeof(tmp->exten)-1);