Is possibile to have a on_rx_rtp callback with PJSUA?

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

 



Hi Benny,
first of all thanks for your reply

Benny Prijono wrote:
> On 3/15/08, Davide Marrone <unidavide at email.it> wrote:
>> Hi Samuel,
>>  maybe my question wasn't exactly clear. I don't need to receive or hang
>>  up an incoming call, I need to make an outgoing call from my sip client
>>  to exeternal phones. The problem is that I don't know exatly when the
>>  external phone is ringing because via SIP aren't sent packets about that.
>>
> 
> Is this because the 18x response is lost? If so, reliable provisional
> response should solve it I think. You can require remote to send
> response reliably with --use-100rel option in pjsua.
> 

no, the problem isn't that, the service (voip.eutelia.it and others 
italian services) doesn't send this packet, I don't know why, but it 
doesn't arrive, if I use --use-100rel when I try to make a call I get

  20:18:40.527  test.c Entered in on_call_state
  20:18:40.527  test.c Call 0 is DISCONNECTED [reason=420 (Bad Extension)]

while without it the call is made correctly, anyway I don't think that 
100rel is the problem

> If you think that listening for incoming RTP is the only way to go,
> then for now the only way is to hack the UDP media transport to call
> your callback whenever there's an incoming RTP packet. Or something
> like that, I haven't thought of this very thoroughly.

Yes, I'm really sure that the only thing to do is to intercept the 
incoming RTP traffic. I have discoverd it using xten-xlite, I have made 
a lot of tries with tcpdump & ngrep, when I make a call to an external 
phone I have saw that:
- the SIP packet 180 ringing doesn't arrive, never
- I receive a SIP packet: 183 Session Progress
- xten-xlite doesn't play the local ringing tone until the change of RTP 
traffic

I really made many tries and I'm sure that the only SIP packet that 
arrive when the call in on going is 183 Session Progress and "viewing" 
with ngrep the RTP packets is really clear that, at a moment when the 
traffic change, the client start to play the local ringing tone that 
simulate the remote ringing. This moment is exactly when the remote 
phone is really ringing. So I'm sure at 100% that I have to get the RTP 
traffic.
I don't already know what changes of the traffic I have to intercept but 
first of all I have to get it.

> In the future I'm planning to add another callback in pjsua-lib to
> allow application to create its own media transport (or to report
> media transport creation). This among other thing will enable
> application such as yours to do some work with the transport.

great, but for now there is a solution to my problem?
I have tried to do that:

	// ...
	// initialization of pjsua and registration to the server
	// ...

	// make the call
	status = pjsua_call_make_call(acc_id, &uri, 0, NULL, NULL, &call_id);
	if (status != PJ_SUCCESS) error_exit("Error making call", status);
			
	// the call start correctly, i receive the SIP 183 packet
	// and my remote phone rings

	pjsua_call *call;
	pjmedia_sock_info skinfo;

	call = &pjsua_var.calls[call_id];		

	// get transport info
    	pjmedia_transport_get_info(call->med_tp, &skinfo);
	if (status != PJ_SUCCESS) error_exit("Error getting info", status);

	pj_sockaddr_in rem_addr;
	pj_sockaddr_in rem_rtcp;
	rem_addr= (pj_sockaddr_in)skinfo.rtp_addr_name;
	rem_rtcp= (pj_sockaddr_in)skinfo.rtcp_addr_name;

	// is correct this detach ?
	pjmedia_transport_detach(call->med_tp, call->user_data);
	if (status != PJ_SUCCESS) error_exit("Error detaching transport", status);

	// is correct this ?
	pjmedia_transport_attach(call->med_tp, NULL, &rem_addr, &rem_rtcp, 
sizeof(pj_sockaddr_in), &on_rx_rtp, NULL);
	if (status != PJ_SUCCESS) error_exit("Error attaching transport", status);


but it doesn't work, I'm using a modded version of pjsua, but when I run 
it I got


  20:28:58.792 os_core_unix.c pjlib 0.8.0 for POSIX initialized
  20:28:58.792 sip_endpoint.c Creating endpoint instance...
  20:28:58.793          pjlib select() I/O Queue created (0x814956c)
  20:28:58.793 sip_endpoint.c Module "mod-msg-print" registered
  20:28:58.793 sip_transport. Transport manager created.
  20:28:58.809   pjsua_core.c pjsua version 0.8.0 for i686-pc-linux-gnu 
initialized
  20:28:58.898    pjsua_acc.c Registration sent
  20:28:59.138    pjsua_acc.c sip:024XXXXX at voip.eutelia.it: 
unregistration success
  20:28:59.138         test.c Entered in on_reg_state
  20:28:59.138         test.c Successfully logged in entering main loop
  20:28:59.208         test.c Entered in on_call_state
  20:28:59.208         test.c Call 0 state changed to CALLING
  20:28:59.208         test.c Entered in on_call_tsx_state
  20:28:59.438         test.c Entered in on_call_state
  20:28:59.438         test.c Call 0 state changed to CALLING
  20:28:59.438         test.c Entered in on_call_tsx_state
  20:28:59.438         test.c Entered in on_call_tsx_state
  20:28:59.592         test.c Entered in on_call_tsx_state
  20:29:01.359         test.c Entered in on_call_state
  20:29:01.359         test.c Wait and cancel call numeber: 0
  20:29:01.359         test.c Call 0 state changed to EARLY (183 Session 
Progress)
test: ../src/pjmedia/transport_udp.c:561: transport_attach: Assertion 
`!udp->attached' failed.
Aborted

what's wrong with my code? I have put the pjmedia_transport_detach in 
the code but I got that error.

thanks
Davide

p.s. anyway Benny my best congratulations for all you work, this 
framework is really incredible and useful !



[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