Issue in accessing the Port value in Sip_Transport .cpp (symbian )

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

 



Hello Experts,

I am trying to change the port of PJsip Symbian application Dynamically for
different Users.
In this process i am able to change the port address of all the library
files except Sip_Transport .cpp.

When sip_resolve.c calling sip_transport.cpp to resolve the transport type,
always i am receiving resolved port number as zero(0).

i had tried the following different ways but no success.

1. using static variable within sip_transport.cpp

//code snippit
typedef int (*ptrSip_Transport)() ;
ptrSip_Transport myptr;
//
and the static Data assignment is to Myptr
the function is as follow

static int port;

int getPortinSipTransFromUi()
    {
    return port
    }
myptr =getPortinSipTransFromUi;
and using myptr within sip_Transport .cpp

the value i received in the sip _resolve .c is 0

2.Using Global /Extern variable throughout the code

The port number value gets updated in all UI as well as static library files
except sip_transport.cpp(value received is 0 again)


3. Using the File reding/writitng  finction

code snippit//
filewriting passing NewPortnumber to this function
LogMeForPortNumber(const TDesC& aMessage)
    {
    TPtrC8 representation((TUint8*)(&aMessage)->Ptr(), (&aMessage)->Size());
    _LIT(KFileName,"C:\\XSipDialer\\PortNumber.txt");

    RFs fsSession;
    User::LeaveIfError(fsSession.Connect());
    fsSession.MkDirAll(KFileName);

    RFile myPortFile;

    TInt err=myPortFile.Open(fsSession,KFileName,EFileWrite);

    if(err==KErrNotFound)
        err=myPortFile.Create(fsSession,KFileName,EFileWrite);

    TInt endpos;
    myPortFile.Size(endpos);
    myPortFile.Seek(ESeekStart,endpos);

    //myFile.Write(logBuf);
    myPortFile.Write(representation);
    myPortFile.Close();

    fsSession.Close();
    }

created .c File globally with global veriable accessible throughout the
application.

// reading port num from the file and assiging to global veriable

int changePortNumber()
{
    int dynamicPort;
    FILE* portFile;
    portFile=fopen("C:\\XSipDialer\\PortNumber.txt","r");

    fseek(portFile, 0, SEEK_END);
    long pos = ftell(portFile);
    fseek(portFile, 0, SEEK_SET);

    char *portArray = malloc(pos);
    fread(portArray, pos, 1, portFile);
    fclose(portFile);
    dynamicPort=atoi(portArray);
    free(portArray);
     return dynamicPort;
}



I am writing the new port number of user to a file and reading the file into
a global variable. Now i am using this global variable as "extern"
throughout the code, value gets updated throughout except
sip_transport.cpp(value received is 0 again)

IMP Note:: When i use local variable with hardcoded value as 7060/5060
etc..within sip_transport.cpp file, i am getting register success(local
value is getting updated inside sip_transport.cpp), then why
sip_transport.cpp doesn't allow access to global/other files data within it
as other static library files do.

if any body had came across this situation earlier or had any solution
please let me know


Regards

Dutta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20100421/fd273182/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