Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/outbound_campaign.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ resource "genesyscloud_outbound_campaign" "campaign2" {
- `dynamic_contact_queueing_settings` (Block List, Max: 1) Settings for dynamic queueing of contacts. If not set, default dynamic contact queue settings will be applied (see [below for nested schema](#nestedblock--dynamic_contact_queueing_settings))
- `dynamic_line_balancing_settings` (Block List, Max: 1) Dynamic line balancing settings. (see [below for nested schema](#nestedblock--dynamic_line_balancing_settings))
- `edge_group_id` (String) The EdgeGroup that will place the calls. Required for all dialing modes except preview.
- `max_calls_per_agent` (Number) The maximum number of calls that can be placed per agent on this campaign.
- `max_calls_per_agent` (Number) The maximum number of calls that can be placed per agent on this campaign. Must be >= 1. Supports decimal values (e.g., 1.5, 2.3).
- `no_answer_timeout` (Number) How long to wait before dispositioning a call as 'no-answer'. Default 30 seconds. Only applicable to non-preview campaigns.
- `outbound_line_count` (Number) The number of outbound lines to be concurrently dialed. Only applicable to non-preview campaigns; only required for agentless.
- `preview_time_out_seconds` (Number) The number of seconds before a call will be automatically placed on a preview. A value of 0 indicates no automatic placement of calls. Only applicable to preview campaigns.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ func createOutboundCampaignFn(ctx context.Context, p *outboundCampaignProxy, out
// Set resource context for SDK debug logging
ctx = provider.EnsureResourceContext(ctx, ResourceType)

campaign, resp, err := p.outboundApi.PostOutboundCampaigns(*outboundCampaign, false)
// Use useMaxCallsPerAgentDecimal=true to support decimal values for max_calls_per_agent
campaign, resp, err := p.outboundApi.PostOutboundCampaigns(*outboundCampaign, true)
if err != nil {
return nil, resp, fmt.Errorf("failed to create campaign %s", err)
}
Expand Down Expand Up @@ -234,7 +235,8 @@ func updateOutboundCampaignFn(ctx context.Context, p *outboundCampaignProxy, id
outboundCampaign.CampaignStatus = campaign.CampaignStatus
}
outboundCampaign.Version = campaign.Version
outboundCampaign, resp, err = p.outboundApi.PutOutboundCampaign(id, *outboundCampaign, false)
// Use useMaxCallsPerAgentDecimal=true to support decimal values for max_calls_per_agent
outboundCampaign, resp, err = p.outboundApi.PutOutboundCampaign(id, *outboundCampaign, true)
if err != nil {
return nil, resp, fmt.Errorf("failed to update campaign: %s", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,14 @@ func readOutboundCampaign(ctx context.Context, d *schema.ResourceData, meta inte
resourcedata.SetNillableValue(d, "campaign_status", campaign.CampaignStatus)
resourcedata.SetNillableValueWithInterfaceArrayWithFunc(d, "phone_columns", campaign.PhoneColumns, flattenPhoneColumn)
resourcedata.SetNillableValue(d, "abandon_rate", campaign.AbandonRate)
resourcedata.SetNillableValue(d, "max_calls_per_agent", campaign.MaxCallsPerAgent)
// Use MaxCallsPerAgentDecimal if available, fall back to MaxCallsPerAgent for backward compatibility
if campaign.MaxCallsPerAgentDecimal != nil {
resourcedata.SetNillableValue(d, "max_calls_per_agent", campaign.MaxCallsPerAgentDecimal)
} else if campaign.MaxCallsPerAgent != nil {
// Convert int to float64 for backward compatibility with existing campaigns
maxCallsFloat := float64(*campaign.MaxCallsPerAgent)
_ = d.Set("max_calls_per_agent", maxCallsFloat)
}
if campaign.DncLists != nil {
_ = d.Set("dnc_list_ids", util.SdkDomainEntityRefArrToSet(*campaign.DncLists))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ func ResourceOutboundCampaign() *schema.Resource {
Type: schema.TypeFloat,
},
`max_calls_per_agent`: {
Description: `The maximum number of calls that can be placed per agent on this campaign.`,
Description: `The maximum number of calls that can be placed per agent on this campaign. Must be >= 1. Supports decimal values (e.g., 1.5, 2.3).`,
Optional: true,
Type: schema.TypeInt,
ValidateFunc: validation.IntAtLeast(1),
Type: schema.TypeFloat,
ValidateFunc: validation.FloatAtLeast(1),
},
`dnc_list_ids`: {
Description: `DncLists for this Campaign to check before placing a call.`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,44 @@ func TestAccResourceOutboundCampaignPower(t *testing.T) {
"dynamic_line_balancing_settings.0.relative_weight", "15"),
),
},
{
// Update with decimal max_calls_per_agent value
Config: referencedResources +
generateOutboundCampaign(
resourceLabel,
name,
dialingMode,
strconv.Quote(callerName),
strconv.Quote(callerAddress),
"genesyscloud_outbound_contact_list."+contactListResourceLabel+".id",
util.NullValue,
util.NullValue,
strconv.Quote(scriptId),
"genesyscloud_routing_queue."+queueResourceLabel+".id",
"genesyscloud_telephony_providers_edges_site."+siteId+".id",
"1",
"1.5",
util.NullValue,
"genesyscloud_outbound_callanalysisresponseset."+carResourceLabel+".id",
util.NullValue,
util.NullValue,
util.NullValue,
util.NullValue,
util.NullValue,
util.NullValue,
[]string{},
[]string{},
[]string{},
[]string{},
strconv.Quote("true"),
generatePhoneColumnNoTypeBlock("Cell"),
generateDynamicLineBalancingSettingsBlock(util.TrueValue, "15"),
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourcePath, "name", name),
resource.TestCheckResourceAttr(resourcePath, "max_calls_per_agent", "1.5"),
),
},
{
// Import/Read
ResourceName: resourcePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func getOutboundCampaignFromResourceData(d *schema.ResourceData) platformclientv
noAnswerTimeout := d.Get("no_answer_timeout").(int)
callAnalysisLanguage := d.Get("call_analysis_language").(string)
priority := d.Get("priority").(int)
maxCallsPerAgent := d.Get("max_calls_per_agent").(int)
maxCallsPerAgent := d.Get("max_calls_per_agent").(float64)
skillColumns := lists.InterfaceListToStrings(d.Get("skill_columns").([]interface{}))
autoAnswer := d.Get("auto_answer").(bool)

Expand Down Expand Up @@ -99,8 +99,8 @@ func getOutboundCampaignFromResourceData(d *schema.ResourceData) platformclientv
if priority != 0 {
campaign.Priority = &priority
}
if maxCallsPerAgent != 0 {
campaign.MaxCallsPerAgent = &maxCallsPerAgent
if maxCallsPerAgent >= 1 {
campaign.MaxCallsPerAgentDecimal = &maxCallsPerAgent
}
return campaign
}
Expand Down