Smart forwarding

If assigning extension numbers to managers was implemented, then you can also perform Smart forwarding feature. When a call comes from a client saved in the Kommo account and has a responsible user, Kommo provides retrieving the responsible user ID alongside with the information about the caller ID as mentioned before in the search by phone method.

Once you get the responsible user ID you can show a notification about the incoming call in the responsible user interface using the call event method from the call notification API, and get which extension they occupy, and then request forwarding the call from the VoIP service.

For example, as we previously implemented the database diagram, and assigned the manager an extension, we can get the extension the responsible user occupies by performing the following code:

public static function getSmartForward(int $kommoAccountID, int $responsibleUserID)
{
    return VoipUsers::query()
        ->where('kommo_account_id', '=', $kommoAccountId)
        ->where('kommo_user_id', '=', $kommoUserId)
        ->first();
}

And then you can request the VoIP forwarding service.


What’s Next

Next making calls inside Kommo use case.