diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-16 18:49:46 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-16 18:49:46 +0000 |
commit | 2cfc3be9fff7e7734fa6a647e289eddfaefb82a6 (patch) | |
tree | c7371453f0707b856ca3c81dd317c80e6e1c4f38 /res | |
parent | 1bb80944bcd0992b365b5ca00dc37ef7093837f0 (diff) |
introduce a function to set context, extension and priority
replacing some common blocks of code (there are still a few
instances where it can be used)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20598 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r-- | res/res_features.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/res/res_features.c b/res/res_features.c index cf6c6f914..d789d7657 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -159,6 +159,14 @@ struct ast_bridge_thread_obj struct ast_channel *peer; }; +/* store context, priority and extension */ +static void set_c_e_p(struct ast_channel *chan, const char *ctx, const char *ext, int pri) +{ + ast_copy_string(chan->context, ctx, sizeof(chan->context)); + ast_copy_string(chan->exten, ext, sizeof(chan->exten)); + chan->priority = pri; +} + static void check_goto_on_transfer(struct ast_channel *chan) { struct ast_channel *xferchan; @@ -212,7 +220,7 @@ static void *ast_bridge_call_thread(void *data) ast_bridge_call(tobj->peer, tobj->chan, &tobj->bconfig); ast_hangup(tobj->chan); ast_hangup(tobj->peer); - tobj->chan = tobj->peer = NULL; + bzero(tobj, sizeof(*tobj)); /* XXX for safety */ free(tobj); return NULL; } @@ -372,9 +380,7 @@ int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int ast_channel_masquerade(chan, rchan); /* Setup the extensions and such */ - ast_copy_string(chan->context, rchan->context, sizeof(chan->context)); - ast_copy_string(chan->exten, rchan->exten, sizeof(chan->exten)); - chan->priority = rchan->priority; + set_c_e_p(chan, rchan->context, rchan->exten, rchan->priority); /* Make the masq execute */ f = ast_read(chan); @@ -589,9 +595,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p res = -1; } else { /* Set the channel's new extension, since it exists, using transferer context */ - ast_copy_string(transferee->exten, newext, sizeof(transferee->exten)); - ast_copy_string(transferee->context, transferer_real_context, sizeof(transferee->context)); - transferee->priority = 0; + set_c_e_p(transferee, transferer_real_context, newext, 0); } check_goto_on_transfer(transferer); return res; |