[asterisk-users] asterisk run on vxworks for hardware pbx

vicker vicker vicker00 at gmail.com
Wed Dec 20 02:38:05 MST 2006


Hi
My hardware PBX run asterisk on vxworks,Because the vxworks not support
perl.
Now I want to add a callback function to my pbx.



now it can store Caller and Called party numbers in queue when Called party
is busy



Then I malloc a new ast_channel to call.It is should use

ast_get_channel_by_exten_locked() or ast_channel_alloc() ,

my program as follow,But it isn't work, anyone know how to do this.

{

           struct ast_channel *callbk;

            char *callbk_real_context;

            char xferto[256],dialstr[265];

            char *cid_num;

            char *cid_name;

            int outstate=0;

            char *exten = NULL ,*context = NULL;



             pu = head;               //pu is a queue hav dst and src number





                        printfl("\n\n\n\n  %s time is over",pu->dst);

                        show_queue(head);





                        memset(xferto, 0, sizeof(xferto));



                        //callbk = ast_channel_alloc(0);





                        callbk = ast_get_channel_by_exten_locked(pu->dst,
context);



                        if (!ast_strlen_zero(callbk->macrocontext))

                                    callbk_real_context =
callbk->macrocontext;

                        else

                                    callbk_real_context = callbk->context;





                        ast_copy_string(xferto,pu->dst,sizeof(xferto));

                        cid_num = callbk->cid.cid_num;

                        cid_name = callbk->cid.cid_name;



                        if (ast_exists_extension(callbk,
callbk_real_context,xferto, 1, cid_num)) {

                                    snprintf(dialstr, sizeof(dialstr),
"%s@%s/n", xferto, callbk_real_context);

                                    }



                        callback_request_and_dial(callbk, "Local",
ast_best_codec(callbk->nativeformats), dialstr, 15000, &outstate, cid_num,
cid_name);

   }

   static struct ast_channel *callback_request_and_dial(struct ast_channel
*caller, const char *type, int format, void *data, int timeout, int
*outstate, const char *cid_num, const char *cid_name)
{
 int cause = 0;
 struct ast_channel *chan;
 if ((chan = ast_request(type, format, data, &cause))) {

  ast_set_callerid(chan, cid_num, cid_name, cid_num);
  ast_channel_inherit_variables(caller, chan);
  printfl("\n\n In if ((chan = ast_request(type, format, data, &cause)))");
  if (!ast_call(chan, data, timeout)) {
   dosomething;
   }

    dosomething;
  }
}





thinks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20061220/b09f0fc7/attachment.htm


More information about the asterisk-users mailing list