|
|
|
@ -301,7 +301,7 @@ void pstn_destroy(pstn_t *pstn)
|
|
|
|
|
PDEBUG(DTEL, DEBUG_DEBUG, "PSTN instance destroyed\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void pstn_timeout(struct timer *timer);
|
|
|
|
|
static void pstn_timeout(void *data);
|
|
|
|
|
void recv_dtmf(void *priv, char digit, dtmf_meas_t __attribute__((unused)) *meas);
|
|
|
|
|
|
|
|
|
|
static void pstn_new_state(pstn_t *pstn, enum pstn_state state)
|
|
|
|
@ -332,11 +332,6 @@ int pstn_init(pstn_t *pstn, const char *name, const char *socketname, const char
|
|
|
|
|
pstn->ringing_type_hold = ringing_type_hold;
|
|
|
|
|
pstn->tones_type = tones_type;
|
|
|
|
|
|
|
|
|
|
/* create ph socket */
|
|
|
|
|
rc = ph_socket_init(&pstn->ph_socket, ph_socket_rx_msg, pstn, socketname, 0);
|
|
|
|
|
if (rc < 0)
|
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
|
|
/* init DTMF detector */
|
|
|
|
|
rc = dtmf_decode_init(&pstn->dtmf_dec, pstn, recv_dtmf, 8000, db2level(6.0), db2level(-30.0));
|
|
|
|
|
if (rc < 0)
|
|
|
|
@ -365,6 +360,11 @@ int pstn_init(pstn_t *pstn, const char *name, const char *socketname, const char
|
|
|
|
|
/* bring into service */
|
|
|
|
|
pstn_new_state(pstn, PSTN_STATE_BLOCKED);
|
|
|
|
|
|
|
|
|
|
/* create ph socket here because we get a reply from the function call */
|
|
|
|
|
rc = ph_socket_init(&pstn->ph_socket, ph_socket_rx_msg, pstn, socketname, 0);
|
|
|
|
|
if (rc < 0)
|
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -385,17 +385,6 @@ void rtp_receive(struct osmo_cc_session_codec *codec, uint8_t __attribute__((unu
|
|
|
|
|
jitter_save(&pstn->tx_dejitter, data, len, 1, sequence, timestamp, ssrc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void rtp_work(pstn_t *pstn)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
|
if (pstn->call[i]->cc_session)
|
|
|
|
|
osmo_cc_session_handle(pstn->call[i]->cc_session, pstn->call[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void dtmf_on(pstn_t *pstn)
|
|
|
|
|
{
|
|
|
|
|
if (pstn->dtmf_on)
|
|
|
|
@ -1722,14 +1711,13 @@ static void v5_disc_req_and_cleanup(pstn_t *pstn)
|
|
|
|
|
v5_send(pstn, PSTN_EVENT_DISC_REQ, NULL, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* timeout
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static void pstn_timeout(struct timer *timer)
|
|
|
|
|
static void pstn_timeout(void *data)
|
|
|
|
|
{
|
|
|
|
|
pstn_t *pstn = timer->priv;
|
|
|
|
|
pstn_t *pstn = data;
|
|
|
|
|
|
|
|
|
|
switch (pstn->timer_ident) {
|
|
|
|
|
case TIMER_IDENT_DIALING:
|
|
|
|
@ -1781,12 +1769,3 @@ static void pstn_timeout(struct timer *timer)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* work
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
void pstn_work(pstn_t *pstn)
|
|
|
|
|
{
|
|
|
|
|
ph_socket_work(&pstn->ph_socket);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|