How to set url for *agrv[]?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pjsua_simple.c is self documented:

/**
 * simple_pjsua.c
 *
 * This is a very simple but fully featured SIP user agent, with the
 * following capabilities:
 *  - SIP registration
 *  - Making and receiving call
 *  - Audio/media to sound device.
 *
 * Usage:
 *  - To make outgoing call, start simple_pjsua with the URL of remote
 *    destination to contact.
 *    E.g.:
 *     simpleua sip:user at remote
 *
 *  - Incoming calls will automatically be answered with 200.
 *
 * This program will quit once it has completed a single call.
 */

Also, if you want simple_pjsua to register, you'll need to change this
values and recompile it:

#define SIP_DOMAIN    "example.com"
#define SIP_USER    "alice"
#define SIP_PASSWD    "secret"

Seems like the sample itself is counting on translating "example.com" as the
DNS to your registrar/proxy.

And yes, you're right about the 'h' key.

2009/9/11 Rachel Baskaran <rachelbaskaran at gmail.com>

> Thanks that did help!
>
> But when I press 'h' it says, APP Call 0 state=DISCONNECTED. so this means
> I talk to the user (sip:user at example.com <sip%3Auser at example.com> ) and
> when I press 'h' it terminates the call to the user I dialed right?
>
> Will I able to do the same if I place a phone number (
> 418-345-6789 at sipprovider.com )?
> Provided I have a proper dial plan and SIP PROXY to handle the call.
>
> Or do I need to write any separate script to do the dialing to a number?
>
>
> Thanks!
>
> 2009/9/11 Paulo Rog?rio Panhoto <paulo at voicetechnology.com.br>
>
>> perhaps the fatal exception comes from the uninitialized uri variable.
>>
>> Anyway, this is how I found that line in the source:
>>     if (argc > 1) {
>>     pj_str_t uri = pj_str(argv[1]);
>>     status = pjsua_call_make_call(acc_id, &uri, 0, NULL, NULL, NULL);
>>     if (status != PJ_SUCCESS) error_exit("Error making call", status);
>>     }
>>
>>
>> 2009/9/11 Rachel Baskaran <rachelbaskaran at gmail.com>
>>
>>>  Alright, it showed me error undeclared in URI in below line
>>> pj_str_t uri=pj_str(URI);
>>>  so I changed to
>>> pj_str_t uri;
>>>
>>> And entered my exe folder(pjsip-apps/bin/rach/i686-pc-mingw32)
>>> simple_pjsua   sip:rachel at example.com <sip%3Arachel at example.com> ->
>>> Enter
>>>
>>> It registered but  a fatal error was displayed:
>>> pjsua_acc.c Registration sent
>>> pjsua_media.c Opening sound device
>>> except.c !!! FATAL: unhandled exception PJLIB/no memory
>>> Assertion failed: handler != ((void *)0), file ...src/pj/except.c, line
>>> 50.
>>>
>>>
>>> If run the script like simple_pjsua.c ->Enter
>>>
>>> It runs the header for few mins and displays, SIP registration failed
>>> timeout. Since I'm testing just typed sip:user at example.com<sip%3Auser at example.com>-> Enter, it just displayed the options 'h' hangup the calls and 'q' to
>>> quit.
>>>
>>> Am I building it in right way, if YES, Why do I get that FATAL error?
>>>
>>> Thanks!
>>>
>>>
>>> 2009/9/11 Paulo Rog?rio Panhoto <paulo at voicetechnology.com.br>
>>>
>>> argv[1] is the first argument you pass to a program in command line. i.e.
>>>> simple_ua.exe sip:user at example.org <sip%3Auser at example.org>
>>>>
>>>> 2009/9/11 Rachel Baskaran <rachelbaskaran at gmail.com>
>>>>
>>>>> Hey,
>>>>>
>>>>> I'm trying to edit the simple_pjsua.c to call a specified URL using
>>>>> pjsua_call_make_call. The proram compiled successfully and registers too,
>>>>> but doesn't call the URL since I didn't know where or how to define my
>>>>> destination URL in main fn()
>>>>>
>>>>> int main(int argc,char *argv[])
>>>>> {
>>>>> pjsua_acc_id acc_id;
>>>>> pj_status_t status;
>>>>>
>>>>>
>>>>>
>>>>> status = pjsua_create();
>>>>> if(status != PJ_SUCCESS)  error_exit("Error in pjsua_create()",
>>>>> status);
>>>>>
>>>>>
>>>>> if(argc > 1)
>>>>> {
>>>>> status = pjsua_verify_sip_url(argv[1]);
>>>>> if(status != PJ_SUCCESS)  error_exit("Invalid URL in argv", status);
>>>>> }
>>>>>
>>>>> /* Init pjsua */
>>>>>  {
>>>>>
>>>>> pjsua_config cfg;
>>>>> pjsua_logging_config log_cfg;
>>>>>
>>>>>
>>>>> pjsua_config_default(&cfg);
>>>>> cfg.cb.on_incoming_call = &on_incoming_call;
>>>>> cfg.cb.on_call_media_state = &on_call_media_state;
>>>>> cfg.cb.on_call_state = &on_call_state;
>>>>>
>>>>>
>>>>>
>>>>> pjsua_logging_config_default(&log_cfg);
>>>>> log_cfg.console_level = 4;
>>>>>
>>>>>
>>>>> status = pjsua_init(&cfg, &log_cfg, NULL);
>>>>> if(status != PJ_SUCCESS)  error_exit("Error in pjsua_init()", status);
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> /* add UDP transport */
>>>>> {
>>>>>
>>>>> pjsua_transport_config cfg;
>>>>>  pjsua_transport_config_default(&cfg);
>>>>> cfg.port = 5060;
>>>>> status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg, NULL);
>>>>> if(status != PJ_SUCCESS)  error_exit("Error creating transport",
>>>>> status);
>>>>> }
>>>>> /* start pjsua */
>>>>>
>>>>> status = pjsua_start();
>>>>> if(status != PJ_SUCCESS) error_exit("Error starting pjsua", status);
>>>>>
>>>>> /* Register to SIP server creating an account */
>>>>>
>>>>> {
>>>>> pjsua_acc_config cfg;
>>>>>
>>>>>
>>>>> pjsua_acc_config_default(&cfg);
>>>>> cfg.id = pj_str("sip:" SIP_USER "@" SIP_DOMAIN);
>>>>> cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);
>>>>> cfg.cred_count = 1;
>>>>> cfg.cred_info[0].realm = pj_str(SIP_DOMAIN);
>>>>> cfg.cred_info[0].scheme = pj_str("digest");
>>>>> cfg.cred_info[0].username = pj_str(SIP_USER);
>>>>> cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
>>>>> cfg.cred_info[0].data = pj_str(SIP_PASSWD);
>>>>>
>>>>> status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id);
>>>>> if(status != PJ_SUCCESS)  error_exit("Error adding account", status);
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> if(argc > 1)
>>>>> {
>>>>>
>>>>> pj_str_t uri=pj_str(URI);
>>>>>
>>>>> status = pjsua_call_make_call(acc_id, &uri, 0, NULL, NULL, NULL);
>>>>> if(status != PJ_SUCCESS) error_exit("Error making call", status);
>>>>> }
>>>>>
>>>>> Any help would be great!
>>>>>
>>>>> Rachel
>>>>>
>>>>> _______________________________________________
>>>>> Visit our blog: http://blog.pjsip.org
>>>>>
>>>>> pjsip mailing list
>>>>> pjsip at lists.pjsip.org
>>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Visit our blog: http://blog.pjsip.org
>>>>
>>>> pjsip mailing list
>>>> pjsip at lists.pjsip.org
>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Visit our blog: http://blog.pjsip.org
>>>
>>> pjsip mailing list
>>> pjsip at lists.pjsip.org
>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>
>>>
>>
>> _______________________________________________
>> Visit our blog: http://blog.pjsip.org
>>
>> pjsip mailing list
>> pjsip at lists.pjsip.org
>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>
>>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090912/3ffb169e/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux