+static const char *media_type2name(unsigned char media_type) {
+ switch (media_type) {
+ case MEDIA_TYPE_ULAW:
+ return "PCMU";
+ case MEDIA_TYPE_ALAW:
+ return "PCMA";
+ case MEDIA_TYPE_GSM:
+ return "GSM";
+ case MEDIA_TYPE_GSM_HR:
+ return "GSM-HR";
+ case MEDIA_TYPE_GSM_EFR:
+ return "GSM-EFR";
+ case MEDIA_TYPE_AMR:
+ return "AMR";
+ }
+
+ return "UKN";
+}
+
+/* PROCEEDING INDICATION (from MS) */
+void Pgsm_bs::call_conf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc)
+{
+ int media_types[8];
+ unsigned char payload_types[8];
+ int payloads = 0;
+
+ gsm_trace_header(p_g_interface_name, this, msg_type, DIRECTION_IN);
+ if (mncc->fields & MNCC_F_CAUSE) {
+ add_trace("cause", "coding", "%d", mncc->cause.coding);
+ add_trace("cause", "location", "%", mncc->cause.location);
+ add_trace("cause", "value", "%", mncc->cause.value);
+ }
+ end_trace();
+
+ new_state(PORT_STATE_OUT_PROCEEDING);
+
+ /* get list of offered payload types
+ * if list ist empty, the FR V1 is selected */
+ select_payload_type(mncc, payload_types, media_types, &payloads, sizeof(payload_types));
+ /* if no given payload type is supported, we assume */
+ if (!payloads) {
+ media_types[0] = MEDIA_TYPE_GSM;
+ payload_types[0] = PAYLOAD_TYPE_GSM;
+ payloads = 1;
+ }
+
+ /* select first payload type that matches the rtp list */
+ if (p_g_rtp_bridge) {
+ int i, j;
+
+ for (i = 0; i < p_g_rtp_payloads; i++) {
+ for (j = 0; j < payloads; j++) {
+ if (p_g_rtp_media_types[i] == media_types[j])
+ break;
+ }
+ if (j < payloads)
+ break;
+ }
+ if (i == p_g_rtp_payloads) {
+ struct lcr_msg *message;
+
+ /* payload offered by remote RTP is not supported */
+ message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_RELEASE);
+ message->param.disconnectinfo.cause = 65;
+ message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
+ message_put(message);
+ /* send release */
+ mncc = create_mncc(MNCC_REL_REQ, p_g_callref);
+ gsm_trace_header(p_g_interface_name, this, MNCC_REL_REQ, DIRECTION_OUT);
+ mncc->fields |= MNCC_F_CAUSE;
+ mncc->cause.coding = 3;
+ mncc->cause.location = LOCATION_PRIVATE_LOCAL;
+ mncc->cause.value = 65;
+ add_trace("cause", "coding", "%d", mncc->cause.coding);
+ add_trace("cause", "location", "%d", mncc->cause.location);
+ add_trace("cause", "value", "%d", mncc->cause.value);
+ add_trace("reason", NULL, "None of the payload types are supported by MS");
+ end_trace();
+ send_and_free_mncc(p_g_lcr_gsm, mncc->msg_type, mncc);
+ new_state(PORT_STATE_RELEASE);
+ trigger_work(&p_g_delete);
+
+ return;
+ }
+ modify_lchan(p_g_rtp_media_types[i]);
+ /* use the payload type from received rtp list, not from locally generated payload types */
+ p_g_payload_type = p_g_rtp_payload_types[i];
+ } else {
+ /* modify to first given payload */
+ modify_lchan(media_types[0]);
+ p_g_payload_type = payload_types[0];
+ }
+}
+