0

I'm using pjsua python module, and I don't know how to create a custom message like below:

mY'0E@@b,%+&KEEPALIVE sip:user@192.168.0.10 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.10;rport;branch=z9hG4bKPjgdQdo8azxxwRZ9aCVJy5Wdr27fTgDBUy
Max-Forwards: 70
From: <sip:user@192.168.0.10>;tag=w0na7ZUHDVaB8QG38EGdH5f23W3fzKL6
To: <sip:server@192.168.0.10>
Contact: <sip:server@192.168.0.10>
Call-ID: -TtcAtmNnJM5uteQDgMmddoWx7IM1fDP
CSeq: 1 KEEPALIVE
Applier-ID: 24598
Expires: 2147483647
User-Agent: PU/1.0.0
Content-Length:  0

Obs: The server and client are in the same PC.

Exists any way to do this? Thanks.

Philipp
  • 15,377
  • 4
  • 35
  • 52
David Viana
  • 516
  • 2
  • 8
  • 17
  • What is this KEEPALIVE message? Is it defined in any standard? – yotommy Mar 28 '14 at 19:38
  • No, yotomy the server application gets this custom KEEPALIVE for know if the client is alive. I can't change this standard because is a old legacy system. – David Viana Mar 28 '14 at 19:55

1 Answers1

1

I haven't tried this, but you may be able to do this by using the py_pjsua module:

http://trac.pjsip.org/repos/wiki/Py_PJSUA

pjsua_call_send_request: Send arbitrary request with the call. This is useful for example to send INFO request. Note that application should not use this function to send requests which would change the invite session's state, such as re-INVITE, UPDATE, PRACK, and BYE.

A message on the PJSIP mailing list addresses a similar case, and indicates that the on_call_tsx_state() callback can be used to watch for the response.

This seems to match your requirement, as I assume that the KEEPALIVE does not change the session state. See documentation here.

yotommy
  • 1,472
  • 1
  • 12
  • 17
  • Thank you, but I think the function send_request will use "Cseq: 'number' INFO", and I can't change INFO for another word but I will test, thank you again. – David Viana Mar 30 '14 at 16:14
  • I would expect the contents of the second argument to pjsua_call_send_request (labeled "method") to properly influence the CSeq, but I have not tried it. – yotommy Mar 31 '14 at 12:29
  • Thank you yotommy, I can use the method for send "KEEPALIVE", thanks. – David Viana Apr 01 '14 at 17:24