-/* screen caller id
- * out==0: incomming caller id, out==1: outgoing caller id
- */
-void EndpointAppPBX::screen(int out, char *id, int idsize, int *type, int *present)
-{
- struct interface *interface;
-
- interface = interface_first;
- while(interface)
- {
- if (!strcmp(e_callerinfo.interface, interface->name))
- {
- break;
- }
- interface = interface->next;
- }
-add logging
- if (interface)
- {
- /* screen incoming caller id */
- if (!out)
- {
- /* check for MSN numbers, use first MSN if no match */
- msn1 = NULL;
- ifmsn = interface->ifmsn;
- while(ifmns)
- {
- if (!msn1)
- msn1 = ifmns->msn;
- if (!strcmp(ifmns->mns, id))
- {
- break;
- }
- ifmsn = ifmsn->next;
- }
- if (!ifmns && mns1) // not in list, first msn given
- UNCPY(id, msn1, idsize);
- id[idsize-1] = '\0';
- }
-
- /* check screen list */
- if (out)
- iscreen = interface->ifscreen_out;
- else
- iscreen = interface->ifscreen_in;
- while (ifscreen)
- {
- if (ifcreen->match_type==-1 || ifscreen->match_type==*type)
- if (ifcreen->match_present==-1 || ifscreen->match_present==*present)
- {
- if (strchr(ifcreen->match_id,'%'))
- {
- if (!strncmp(ifscreen->match_id, id, strchr(ifscreen->match_id,'%')-ifscreen->match_id))
- break;
- } else
- {
- if (!strcmp(ifscreen->match_id, id))
- break;
- }
- }
- ifscreen = ifscreen->next;
- }
- if (ifscreen) // match
- {
- if (ifscren->result_type != -1)
- *type = ifscreen->result_type;
- if (ifscren->result_present != -1)
- *present = ifscreen->result_present;
- if (strchr(ifscreen->match_id,'%'))
- {
- SCPY(suffix, strchr(ifscreen->match_id,'%') - ifscreen->match_id + id);
- UNCPY(id, ifscreen->result_id);
- id[idsize-1] = '\0';
- if (strchr(ifscreen->result_id,'%'))
- {
- *strchr(ifscreen->result_id,'%') = '\0';
- UNCAT(id, suffix, idsize);
- id[idsize-1] = '\0';
- }
- } else
- {
- UNCPY(id, ifscreen->result_id, idsize);
- id[idsize-1] = '\0';
- }
- }
- }
-}
-
-/* release call and port (as specified)