/*
* initialize SIP port
*/
-Psip::Psip(int type, char *portname, struct port_settings *settings, struct interface *interface) : Port(type, portname, settings)
+Psip::Psip(int type, char *portname, struct port_settings *settings, struct interface *interface) : Port(type, portname, settings, interface)
{
p_s_rtp_bridge = 0;
if (interface->rtp_bridge)
p_s_rtp_tx_action = 0;
PDEBUG(DEBUG_SIP, "Created new Psip(%s).\n", portname);
+ if (!p_s_sip_inst)
+ FATAL("No SIP instance for interface\n");
}
rtp_close();
}
-const char *media_type2name(uint8_t media_type) {
+static const char *media_type2name(uint8_t media_type) {
switch (media_type) {
case MEDIA_TYPE_ULAW:
return "PCMU";
// psip->rtp_shutdown();
return len;
}
- rc = rtp_decode(psip, buffer, len);
+ if (psip->p_s_rtp_is_connected)
+ rc = rtp_decode(psip, buffer, len);
}
return rc;
int sip_init_inst(struct interface *interface)
{
struct sip_inst *inst = (struct sip_inst *) MALLOC(sizeof(*inst));
+ char local[64];
interface->sip_inst = inst;
SCPY(inst->interface_name, interface->name);
return -EINVAL;
}
- inst->nua = nua_create(inst->root, sip_callback, inst, TAG_NULL());
+ SPRINT(local, "sip:%s",inst->local_peer);
+ if (!strchr(inst->local_peer, ':'))
+ SCAT(local, ":5060");
+ inst->nua = nua_create(inst->root, sip_callback, inst, NUTAG_URL(local), TAG_END());
if (!inst->nua) {
PERROR("Failed to create SIP stack object\n");
sip_exit_inst(interface);