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.