res_parking: Add dialplan function for lot channel

This commit adds a new function to res_parking.

This function, PARK_GET_CHANNEL allows the retrieval
of the channel name of the channel occupying the parking slot.

ASTERISK-22825 #close

Change-Id: Idba6ae55b8a53f734238cb3d995cedb95c0e7b74
This commit is contained in:
Joshua Elson
2018-07-06 16:00:06 -06:00
committed by Richard Mudgett
parent 6d0529cd7f
commit f7137e1230
3 changed files with 107 additions and 0 deletions

View File

@@ -163,6 +163,23 @@ static int retrieve_parked_user_targeted(void *obj, void *arg, int flags)
return 0;
}
struct parked_user *parking_lot_inspect_parked_user(struct parking_lot *lot, int target)
{
struct parked_user *user;
if (target < 0) {
user = ao2_callback(lot->parked_users, 0, NULL, NULL);
} else {
user = ao2_callback(lot->parked_users, 0, retrieve_parked_user_targeted, &target);
}
if (!user) {
return NULL;
}
return user;
}
struct parked_user *parking_lot_retrieve_parked_user(struct parking_lot *lot, int target)
{
RAII_VAR(struct parked_user *, user, NULL, ao2_cleanup);