[pjsip] Pjsua Sample Application Error From Creating Media Transport
Rachel Baskaran
rachelbaskaran at gmail.com
Sun Oct 4 17:02:27 CDT 2009
I don't find code for Initialization of pjsua before you start. So try to
include the code *status= pjsua_init()* before your transport.
// Init pjsua and Logging
pjsua_config_default(&cfg);
pjsua_logging_config_default(
>
> &logCfg);
> status= pjsua_init(&cfg, &logCfg, NULL);
>
if (status != PJ_SUCCESS)
{
cout << "\nError pjsua_init \n\n";
}
Hope this helps!
Rachel
On Sun, Oct 4, 2009 at 5:22 AM, Wong Peter <peterapiit at gmail.com> wrote:
> Hello to all, i have try to code a simple pjsua application.
>
> I encounter error during execution of pjsua_start();
>
> Please help
>
> Thanks.
>
> [code]
> #include <iostream>
>
> #include <pjsua-lib/pjsua.h>
>
>
>
> using namespace std;
>
>
> // Extra Include
> /*#include <pjlib.h>
> #include <pjlib-util.h>
> #include <pjnath.h>
> #include <pjsip.h>
> #include <pjsip_ua.h>
> #include <pjsip_simple.h>
> #include <pjmedia.h>
> #include <pjmedia-codec.h>*/
>
>
>
> // =============================================
> /*
>
> Define PJ_WIN32 = 1 in project settings
>
> Preprocessor Definition/Macro
>
>
>
> http://trac.pjsip.org/repos/wiki/Getting-Started/Windows#Next:Usingpjprojectlibrariesforyourownapplication
> http://trac.pjsip.org/repos/wiki/Getting-Started/Installing-OpenSSL-Windows
>
>
>
> wsock.lib // Window Socket Library
> ws_32.lib // Window Socket 2 Library
>
>
> */
>
>
> // =============================================
>
>
> // =============================================
> int main()
> {
> pjsua_acc_id accID = 0;
> pj_status_t status;
>
> // Initialize pjlib library
> status = pjsua_create();
> if (status != PJ_SUCCESS)
> {
> cout << "Error Creating Pjsua socket";
> }
>
> pjsua_config cfg;
> pjsua_logging_config logCfg;
>
> // Init pjsua and Logging
> pjsua_config_default(&cfg);
> pjsua_logging_config_default(&logCfg);
>
> // cfg.stun_srv;
>
> logCfg.console_level = 4;
> logCfg.decor;
>
>
> // To set VOIP transport Mode -UDP/TCP/TLS/SCTP
> pjsua_transport_config transportCfg;
>
> pjsua_transport_config_default(&transportCfg);
> transportCfg.port = 5060;
> status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &transportCfg, 0);
>
> if (status != PJ_SUCCESS)
> {
> cout << "Error Creating Pjsua transport mode";
> }
>
> // Start Pjsua
> status = pjsua_start();
> if (status != PJ_SUCCESS)
> {
> cout << "\nError start pjsua\n\n";
> }
>
>
> // Register SIP Account
> pjsua_acc_config accountCfg;
> pjsua_acc_config_default(&accountCfg);
>
>
> // Make Call
> pj_str_t SIPURL = pj_str("sip:*061600 at ekiga.net");
> status = ::pjsua_call_make_call(accID, &SIPURL, 0, 0, 0, 0);
> if (status != PJ_SUCCESS)
> {
> cout << "Error VOIP Call";
> }
>
>
> // Destroy pjlib library
> // Unregister SIP account, Hang up call, Terminate presence subscription
> status = pjsua_destroy();
> if (status != PJ_SUCCESS)
> {
> cout << "Error destroy application library";
> }
>
> return 0;
> }
> // =============================================
>
>
>
> // =============================================
>
>
>
> // =============================================
> [/code]
>
> --
> Linux
>
> _______________________________________________
> 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/20091004/c7b2d78f/attachment.html>
More information about the pjsip
mailing list