Failed to Allocate port for RTP instance

Home » Asterisk Users » Failed to Allocate port for RTP instance
Asterisk Users 3 Comments


I am trying to deposit a voicemail message(using voicemail() application) for a subscriber using asterisk- But i am facing  aproblem in the rtp port allocation for a session due to which ‘488 Not Acceptable’ response is sent towards the client end.  Following are error messages:

[Jan 18 12:43:59] ERROR[19164] res_rtp_asterisk.c: Failed to Allocate port 7660 for RTP instance ‘0x1a75ab98’
[Jan 18 12:43:59] ERROR[19164] res_rtp_asterisk.c: Oh dear… we couldn’t allocate a port (x=7662)7660 for RTP instance ‘0x1a75ab98’. errno 99
[Jan 18 12:43:59] DEBUG[19164] rtp_engine.c: Engine ‘asterisk’ failed to setup RTP instance ‘0x1a75ab98’
[Jan 18 12:43:59] DEBUG[19164] rtp_engine.c: Destroyed RTP instance ‘0x1a75ab98’
[Jan 18 12:43:59] DEBUG[19164] chan_sip.c: ERROR: failed to allocate rtp instance
[Jan 18 12:43:59] DEBUG[19164] chan_sip.c: Could not initialize RTP instance for dialog: 800E51A5-1140-E111-A216-001A4B4698C3@

Please  find attached the log file  for more information.



3 thoughts on - Failed to Allocate port for RTP instance

  • The messages you’ve posted above don’t appear to match what is in the
    Asterisk source code; if you’ve modified res_rtp_asterisk.c, then we
    can’t tell you what is wrong if your changes are at fault.

    However, on the surface this looks very simple: there aren’t any RTP
    ports available for the channel Asterisk was trying to setup. Either you
    need to increase the block of ports defined in rtp.conf to make more
    ports available, or you need to ensure that no other application on the
    system is using the same ports, or both.

  • Hi,

    I have not changed res_rtp_asterisk.c Its just that I have put the debug prints in that file.

    In asterisk the allocation of rtp session is done in check_user_full() function called from handle_request_invite. Since we are not handling the authentication of the user I have called function dialog_initialize_rtp() from handle_request_invite().

    I have tried increasing the port ranges but it failed. And the port which asterisk allocates for rtp session is not used by the system(I have checked it using netstat).

    Please find attached the code snippet of handle_request_invite.



    default iconhandle_request_invite.rar