New Method in Agent API - external_dial_lead

Working at a client site I had to implement a New Agent API Method for integrating with the Custom CRM Application of the Client.The client needed Click2Dial functionality from the CRM Application.
The actual implementation of the external_dial method of Agent API permits searching of previously inserted leads and the add_lead method of Admin API permits adding leads for dialing.
Click2Dial can be implemented as follows using the existing API Methods:
- add_lead
- external_pausa
- external_dial
The only impediment is that the add_lead method requires the list_id and this piece of information is not readily available to external applications. (It seems more sensible to me to avoid giving direct access to vicidial tables from external applications, in an ideal world all accesses should be through controlled API calls.)
I have merged the add_lead an external_dial methods to implement an external_dial_lead method. The new method simply accepts lead information additional to the agent information passed to external_dial. The external_dial_lead method checks the Manual Dial List of the actual campaign of the agent_user and adds the lead to this list before placing the call, therefore it does not require that the external application pass the list_id.
The original code had quite deep nested if-then-else statements so I had to reorganise the code a bit to be able to get hold of the code. I could post the code to Mantis if anyone considers this approach of value.
The actual implementation of the external_dial method of Agent API permits searching of previously inserted leads and the add_lead method of Admin API permits adding leads for dialing.
Click2Dial can be implemented as follows using the existing API Methods:
- add_lead
- external_pausa
- external_dial
The only impediment is that the add_lead method requires the list_id and this piece of information is not readily available to external applications. (It seems more sensible to me to avoid giving direct access to vicidial tables from external applications, in an ideal world all accesses should be through controlled API calls.)
I have merged the add_lead an external_dial methods to implement an external_dial_lead method. The new method simply accepts lead information additional to the agent information passed to external_dial. The external_dial_lead method checks the Manual Dial List of the actual campaign of the agent_user and adds the lead to this list before placing the call, therefore it does not require that the external application pass the list_id.
The original code had quite deep nested if-then-else statements so I had to reorganise the code a bit to be able to get hold of the code. I could post the code to Mantis if anyone considers this approach of value.