Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing Listen port in RTC 1.2 version

13 views
Skip to first unread message

rahul.c...@gmail.com

unread,
Jun 16, 2008, 4:26:13 AM6/16/08
to
Hi all,
I am trying to change the listen port of RTC from 5060 to
some other port

For that i am doing the following steps at Intialization


RTCClient->put_ListenForIncomingSessions(RTCLM_DYNAMIC);
BSTR InternalLocalAddr = SysAllocString(LocalIpAdrr);
long InternalLocalPort = 7100;
IRTCClientPortManagement *ClientPortMan = NULL;
RTCClient->QueryInterface(IID_IRTCClientPortManagement,(void **)
&ClientPortMan ); pClientPortManagement-
>StartListenAddressAndPort(InternalLocalAddr ,
InternalLocalPort);

After that i have derived a class from IRTCPortManager
and implemented

HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void
**ppvObject);
ULONG STDMETHODCALLTYPE AddRef(void);
ULONG STDMETHODCALLTYPE Release(void);

HRESULT STDMETHODCALLTYPE GetMapping(BSTR
bstrRemoteAddress,RTC_PORT_TYPE enPortType, BSTR
*pbstrInternalLocalAddress,long *plInternalLocalPort, BSTR
*pbstrExternalLocalAddress,long *plExternalLocalPort) ;

HRESULT STDMETHODCALLTYPE UpdateRemoteAddress(BSTR
bstrRemoteAddress,BSTR bstrInternalLocalAddress,long
lInternalLocalPort, BSTR bstrExternalLocalAddress,long
lExternalLocalPort);

HRESULT STDMETHODCALLTYPE ReleaseMapping( BSTR
bstrInternalLocalAddress,long lInternalLocalPort, BSTR
bstrExternalLocalAddress,long lExternalLocalPort);

In Makecall i did the steps as follows


RTCClient->CreateSession(RTCST_PC_TO_PC, NULL, NULL, NULL, &Session);

IRTCSessionPortManagement *SPortManagement = NULL;
Session->QueryInterface(IID_IRTCSessionPortManagement, (void **)
&SPortManagement);

PortManager = new CCPortManager();//derived class name
IRTCPortManager *pPortManager = NULL;
PortManager->QueryInterface(IID_IRTCPortManager,
(void**)&pPortManager);
SPortManagement->SetPortManager(pPortManager);


after this RTC is calling my implentation of Getmapping automatically
not calling manually
My implementation for Getmapping is as follows

HRESULT STDMETHODCALLTYPE CPortManager::GetMapping(BSTR RemoteAddr,
RTC_PORT_TYPE PortType,
BSTR *InternLocalAddr,long *ILocalPort, BSTR *ELocalAddr,long
*ELocalPort)
{
HRESULT Result = S_OK;
char ILocalIp[20];
WCHAR ILocalIpAdrr[20];
BSTR InternalLocalAddr = SysAllocString("1.1.1.1");//Internal Local
Ip addr
InternLocalAddr = &InternalLocalAddr;
ExternalLocalAddr = &Remote;// Remoteaddress

switch(PType)
{
case RTCPT_AUDIO_RTP:
*ILocalPort = 20000;
*ELocalPort = 30000;
break;
case RTCPT_AUDIO_RTCP:
*ILocalPort = 40100;
*ELocalPort = 50100;
break;
case RTCPT_SIP:
*ILocalPort = 7101;
*ELocalPort = 9001;
break;
} return Result;
}


After Getmapping returns i call the
Session->AddParticipant(Destination, NULL, NULL);

but it is returning with error E_POINTER

but i am getting the Session from createsession correctly

Can any one help me on this issue

Thanks in advance


mik

unread,
Jun 17, 2008, 5:39:23 AM6/17/08
to

Rahul,

At a quick glace:
a. You should check the return code of the RTC functions as it tells
you if the function succeeded.

hr = m_pClient->CreateSession(
enType,
NULL,
NULL,
RTCCS_FORCE_PROFILE, // | RTCCS_FAIL_ON_REDIRECT,
&pSession
);

if (FAILED(hr))
{
// CreateSession failed
DEBUG_PRINT(("CreateSession failed %x", hr ));
return hr;
}


b. To be on the safe side do:

PortManager = new CCPortManager();//derived class name

IRTCPortManager *pPortManager = PortManager;
// PortManager->QueryInterface(IID_IRTCPortManager,
(void**)&pPortManager);
SPortManagement->SetPortManager(pPortManager);

Tell me if my 'hunch' was correct.

Michael

rahul.c...@gmail.com

unread,
Jun 19, 2008, 1:52:06 AM6/19/08
to
On Jun 17, 2:39 pm, mik <rivael...@yahoo.com> wrote:
> Rahul,
>
> At a quick glace:
> a. You should check the return code of theRTCfunctions as it tells

> you if the function succeeded.
>
>     hr = m_pClient->CreateSession(
>         enType,
>         NULL,
>         NULL,
>         RTCCS_FORCE_PROFILE, //  | RTCCS_FAIL_ON_REDIRECT,
>         &pSession
>         );
>
>     if (FAILED(hr))
>     {
>         // CreateSession failed
>         DEBUG_PRINT(("CreateSession failed %x", hr ));
>         return hr;
>     }
>
> b. To be on the safe side do:
>
> PortManager = new CCPortManager();//derived class name
> IRTCPortManager *pPortManager = PortManager;
> // PortManager->QueryInterface(IID_IRTCPortManager,
> (void**)&pPortManager);
> SPortManagement->SetPortManager(pPortManager);
>
> Tell me if my 'hunch' was correct.
>
> Michael

Hi michael,

Thanks for yr response

I have checked the error condition as u said in CreateSession
i am getting the session correctly
and i did as u told but still it showing the same error in
addparticipant as i mention above

can u help me to solve it any other way

Regards
Rakesh

sharad shukla

unread,
Jun 22, 2009, 3:29:02 PM6/22/09
to

Hi Guys,

I have seen your block on net for softphone.

I have also develop softphone using MS RTC Client API 1.3.
It's working fine for direct number i.e any mobile or landline number.

But when we are dailing at that number which has required extension number.
i.e. system generated voice please dial extension number.
How we can handle this and make call on that extension number.

If you have any solution please help me as soon as possible.

Thanks

Regards:

Sharad
Email:shar...@gmail.com

url:http://www.ureader.com/msg/1480798.aspx

0 new messages